note 10858 modified in function.strrpos by tularis

From: Date: Sun, 16 Feb 2003 21:50:49 +0000
Subject: note 10858 modified in function.strrpos by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-44071@lists.php.net to get a copy of this message
[Editor's Note] use if(strpos($str_test, 'a') !== false) { this will check if the TYPE is also a boolean. [/Note] Try this out: //-start $str_test = 'abc'; if (strpos($str_test,'a') != false) { [...do something..] } //-end This condition is false, because strpos returns a 0 for the position of the charater "a". But I supposed strpos will return no "false", because "a" is in the string... But in php false and 0 got the same meening, right?! As a php and programming newbee, I was really confused. --was-- Try this out: //-start $str_test = 'abc'; if (strpos($str_test,'a') != false) { [...do something..] } //-end This condition is false, because strpos returns a 0 for the position of the charater "a". But I supposed strpos will return no "false", because "a" is in the string... But in php false and 0 got the same meening, right?! As a php and programming newbee, I was really confused. http://www.php.net/manual/en/function.strrpos.php

« previous php.notes (#44071) next »