Page 1 of 1

stripos()

Posted: Sun Jun 20, 2004 12:18 am
by navid
hi dear
I will know about stripos()
I know , how to use stripos() function in to the php4.2.3?
please help me

Posted: Sun Jun 20, 2004 1:45 am
by Weirdan
[php_man]stripos[/php_man]

Posted: Sun Jun 20, 2004 2:55 am
by navid
hi Weirdan
thanks

I read it .
but i will use this function in to the php version 4.2.3
if u know please help me

Posted: Sun Jun 20, 2004 3:03 am
by markl999
Have a look at the first user comment at http://php.net/stripos

Posted: Sun Jun 20, 2004 3:06 am
by infolock
quick and simple quesiton : why haven't you upgraded? :P

Posted: Sun Jun 20, 2004 7:04 am
by redmonkey
infolock wrote:quick and simple quesiton : why haven't you upgraded? :P
stripos is only available in PHP5. As PHP5 is still in RC status then there is no point in upgrading to PHP5 if you distribute your apps/scripts to the mass public.

I would be very surprised if you found PHP5 installed on a production server at present and even when PHP5 reaches stable release status it will not make it onto production servers over night.

Here is my stripos function....

Code: Select all

<?php
if (!function_exists('stripos'))
{
  function stripos($haystack, $needle, $offset = 0)
  {
    $temp = substr($haystack, $offset);
    $temp = stristr($temp, $needle);
    $pos = $temp !== false ? strlen($haystack)-strlen($temp) : false;
    return $pos;
  }
}
?>

Posted: Mon Jun 21, 2004 12:04 am
by Weirdan
why not just:

Code: Select all

if (!function_exists('stripos'))
{
  function stripos($haystack, $needle, $offset = 0)
  {
      return strpos(strtolower($haystack), strtolower($needle), $offset);
  }
}
??