if (stripos(strrev($file), "gpj.") === 0) {
echo $file; }

note the ===, 3 equals signs here is very important! check the docs for why.

== means 'equals', and === means 'is identical to'.
Seems like they would do the same thing when comparing '0' to 'the position in the string where that substr is found'. Why not?

0 can mean false in php:

$found = 0;
....
if (!$found) {
  echo "File not found";
}

If a substr comparison matches at char 0:

$string = '12345';
$pos = substr($string, '1');

then without the '===' it would give the wrong result as $pos would be converted to false in this example.

--
Postgresql & php tutorials
http://www.designmagick.com/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to