Hello,
I need to search for a specific string,
like this;
$variable1 = "this is the available text. it has a url named http://www.myurl.com/val=12&id=001 and it has more more sentences as well."
what i wants to do is to search for the string "http://www.myurl.com/" and if that available in $variable1, needs to print "ok"
if( ..?.. )
{
echo "ok";
}
need help!
how to search a string
Moderator: General Moderators
-
cavemaneca
- Forum Commoner
- Posts: 59
- Joined: Sat Dec 13, 2008 2:16 am
Re: how to search a string
strpos() is faster.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
- novice4eva
- Forum Contributor
- Posts: 327
- Joined: Thu Mar 29, 2007 3:48 am
- Location: Nepal
Re: how to search a string
I read strstr() was faster, i bet that it was given in bold letter in old php manual somewherepickle wrote:strpos() is faster.
Code: Select all
http://www.php.net/strstr