note 81195 deleted from function.strpos by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 16:30:42 +0000 |
| Subject: | note 81195 deleted from function.strpos by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-154838@lists.php.net to get a copy of this message | ||
Note Submitter: loaded67 at hotmail dot com
----
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;
}
?>