Re: Buscar cadena dentro de otra cadena
| From: | Miki | Date: | Sun, 17 Dec 2000 21:11:25 +0000 |
| Subject: | Re: Buscar cadena dentro de otra cadena | ||
| References: | 1 2 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-5026@lists.php.net to get a copy of this message | ||
Kiza en strpos ayude :)
---
strpos (PHP3 , PHP4 )
Find position of first occurrence of a string.
int strpos (string haystack, string needle [, int offset])
Returns the numeric position of the first occurrence of needlein the
haystackstring. Unlike the strrpos(), this function can take a full string as
the needleparameter and the entire string will be used. If needleis not found,
returns false.
Note: It is easy to mistake the return values for "character found at position
0" and "character not found". Here s how to detect the difference:
// in PHP 4.0b3 and newer:
$pos = strpos ("b", $mystring);
if ($pos === false) { // note: three equal signs
// not found...
}
// in versions older than 4.0b3:
$pos = strpos ("b", $mystring);
if (is_string ($pos) && !$pos) {
// not found...
}
----
---
Miguel Taipe
sav@bigfoot.com
ICQ#6421941
---