Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

31,104 questions

40,777 answers

573 users

How to use strrchr() function to find the last occurrence of a character in string with PHP

2 Answers

0 votes
// string strrchr(string $haystack, mixed $needle)

$s = "Luke the Skywalker and Yoda the Jedi";

echo strrchr($s, 'e');


/*
run:
    
edi 
    
*/

 





answered Jul 20, 2016 by avibootz
0 votes
// string strrchr(string $haystack, mixed $needle)

$s = "Luke the\n Skywalker\n and\n Yoda the Jedi";

echo strrchr($s, 10); // \n = 10 ascii



/*
run:
    
Yoda the Jedi 
    
*/

 





answered Jul 20, 2016 by avibootz
...