note 96926 deleted from function.strpos by cmb
| From: | cmb@php.net | Date: | Sun, 02 Jun 2019 09:03:02 +0000 |
| Subject: | note 96926 deleted from function.strpos by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211182@lists.php.net to get a copy of this message | ||
Note Submitter: olmstead31 at yahoo dot com
----
I found that whatever I was using as a test with strpos it came out false exept if $pos was == 1
I figured it gives me a numeric value if found else it is null or false
here is what i did to make my code work:
<?php
//EXAMPLE 1:
$quiamime = ',64,68,70,';
$me = '64'
$posi = strpos($quiaime, ",$me,"); //posi is equal to 0
if (!is_numeric($posi)){
//code here
}else{
//else code here
}
//EXAMPLE 2:
$quiamime = ',68,70,64,';
$me = '64'
$posi = strpos($quiaime, ",$me,"); //posi is equal to 6
if (!is_numeric($posi)){
//code here
}else{
//else code here
}
//EXAMPLE 3:
$quiamime = ',68,70,';
$me = '64'
$posi = strpos($quiaime, ",$me,"); //posi is equal to NULL or FALSE
if (!is_numeric($posi)){
//code here
}else{
//else code here
}
?>