[thelist] indexOf in PHP?

Oliver Lineham oliver at lineham.co.nz
Thu Jul 13 05:45:58 CDT 2000


At 17:15 12/07/00 +0100, you wrote:

>Does anyone know the equivalent of JavaScript's indexOf() in PHP?

have you checked "strings" chapter of the manual?
http://www.php.net/manual/ref.strings.php


i'm not a JS guy, but i think indexOf() returns the first occurrence of a 
substring within a string, from a particular position?

you could use strchr()  (see http://www.php.net/manual/function.strchr.php) 
to find the first occurrence of a character, or strstr()  (see 
http://www.php.net/manual/function.strstr.php) for the first occurrence of 
a string, or stristr() for the same thing as strstr() but without case 
sensitivity.

hope that helps,

</ol>

____________________________________________________
     v i b e   m e d i a    http://www.vibe.co.nz/
  po box 10-492              wellington, new zealand
  phone +64 21 210-7845         oliver at lineham.co.nz




More information about the thelist mailing list