![]() |
|
[PHP] Strict Standards!? - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Web Development (https://hackforums.net/forumdisplay.php?fid=183) +---- Thread: [PHP] Strict Standards!? (/showthread.php?tid=2611140) |
Strict Standards!? - DAVEologist - Jun 22, 2012 Darn! I always get this error. Code Strict Standards: Only variables should be passed by reference in C:\XamPP\htdocs\workspace\dawnsite\test.php on line 16This is the code. PHP Code $b is an array of numbers. PHP Code I am trying to make a multiple image uploader, but it always echoes $d no matter i use $d == 'jpg' or $d !== 'jpg' Can someone help me? Php noob here. BTW, here's the form. Code <form action="" method="post" enctype="multipart/form-data" >Thanks so much. :) * - badbrains - Jun 22, 2012 there isn't a line 16.. You're trying to pass an instance by reference. Don't do it. You need PHP 5.4 for that. * - jQuery - Jun 22, 2012 'end' just points the passed variable to the last element. If you don't create it in the memory (create a variable) it won't work. Just change your code to PHP Code * - Love2D - Jun 22, 2012 Well if you're just going to check the file extension, you could use strrchr. PHP Code * - Phizo - Jun 22, 2012 (Jun 22, 2012 05:51 PM)Love2D Wrote: Well if you're just going to check the file extension, you could use strrchr. Just thought I would point out that there is a case-insensitive way of checking via the stristr() function. I'm not sure if you knew about it. You use strstr() (or strchr()) for case-sensitive, strchr() is just an alias of strstr(). PHP Code * - Love2D - Jun 22, 2012 (Jun 22, 2012 10:54 PM)Phizo Wrote: Just thought I would point out that there is a case-insensitive way of checking via the stristr() function. I'm not sure if you knew about it. You use strstr() (or strchr()) for case-sensitive, strchr() is just an alias of strstr(). While that is useful, it won't necessarily help him here. Not to mention the fact that he is looking for a specific character case, and will have to alter his if statement depending on how the user decides to name their file. * - Phizo - Jun 22, 2012 (Jun 22, 2012 11:14 PM)Love2D Wrote: While that is useful, it won't necessarily help him here. Not to mention the fact that he is looking for a specific character case, and will have to alter his if statement depending on how the user decides to name their file. He shouldn't be looking for a specific character case, he should make it case-insensitive. It's less work and better coding practice. * - Love2D - Jun 22, 2012 (Jun 22, 2012 11:18 PM)Phizo Wrote: He shouldn't be looking for a specific character case, he should make it case-insensitive. It's less work and better coding practice. Yeah, he should, hopefully he sees your recommendation. Dear DAVE, Why have you suddenly stopped putting | before and after your thread title? * - DAVEologist - Jun 23, 2012 (Jun 22, 2012 11:18 PM)Phizo Wrote: He shouldn't be looking for a specific character case, he should make it case-insensitive. It's less work and better coding practice. Let me try that. THanks. :) (Jun 22, 2012 11:28 PM)Love2D Wrote: Yeah, he should, hopefully he sees your recommendation. And...I only use || for threads that needs importance in viewing. It's a rather neat way of attracting posters when I need some serious help. And thanks for the help everyone. :) * - Eight - Jun 23, 2012 (Jun 22, 2012 05:51 PM)Love2D Wrote: Well if you're just going to check the file extension, you could use strrchr. Personally I use pathinfo : PHP Code |