How to search for a specific text within a string in PHP

3 Answers

0 votes
$s = "PHP World!";
//    01234

echo strpos($s, "World");


/*
run:

4 

*/

 



answered Oct 31, 2015 by avibootz
0 votes
echo strpos("PHP World!", "World");


/*
run:

4 

*/

 



answered Oct 31, 2015 by avibootz
0 votes
$s = "PHP World!";
//    01234

echo strpos($s, "PHP");


/*
run:

0 

*/

 



answered Oct 31, 2015 by avibootz

Related questions

1 answer 200 views
1 answer 201 views
1 answer 164 views
3 answers 420 views
4 answers 336 views
...