Re: search a string backwards - like reversed stripos

From: Date: Mon, 29 Sep 2003 15:07:51 +0000
Subject: Re: search a string backwards - like reversed stripos
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-164251@lists.php.net to get a copy of this message
* Thus wrote Chris Widmer (pogo@gibts.net): > hello, > > i am looking for a function that easily searches a sting backwards - > just like stripos but reversed. is there already one part of php or does > anyone have a nice function written? right now i do it by reversing the > sting and using strpos, but this is highly inefficient. any ideas/solutions? You could use the strrchr function to achieve this: $pos = strrpos(strtolower($str), $needle); Curt -- "I used to think I was indecisive, but now I'm not so sure."

« previous php.general (#164251) next »