note 81195 added to function.strpos
| From: | loaded67 at hotmail dot com | Date: | Mon, 18 Feb 2008 06:22:50 +0000 |
| Subject: | note 81195 added to function.strpos | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-136236@lists.php.net to get a copy of this message | ||
As mentioned before....
0 === false
0 == false
1 === true
etc...
I found it very usefull to use ctype_digit(); with this function!
<?php
$string = 'whatever!#%@^% is going on...'; //correct
//$string = 'whatever? is going on...'; //false char 8
//ctype_digit only works on strings so type cast...
if(ctype_digit((string) strpos($string, '?'))){
echo 'found at least one...<br/>'.PHP_EOL;
}
else{
echo 'no char index retrieved... <br/>'.PHP_EOL;
}
?>
----
Server IP: 89.248.170.58
Probable Submitter: 62.234.63.246
----
Manual Page -- http://www.php.net/manual/en/function.strpos.php
Edit -- https://master.php.net/note/edit/81195
Del: integrated -- https://master.php.net/note/delete/81195/integrated
Del: useless -- https://master.php.net/note/delete/81195/useless
Del: bad code -- https://master.php.net/note/delete/81195/bad+code
Del: spam -- https://master.php.net/note/delete/81195/spam
Del: non-english -- https://master.php.net/note/delete/81195/non-english
Del: in docs -- https://master.php.net/note/delete/81195/in+docs
Del: other reasons-- https://master.php.net/note/delete/81195
Reject -- https://master.php.net/note/reject/81195
Search -- https://master.php.net/manage/user-notes.php