I'm looking to get the same exact results as php strstr command (while it set to true) but in reverse order.
I know that I can simply reverse the string and use strstr and then reverse it again
but I was wonder if there is any internal php command for the task.
<?php
$myString = 'We don\'t need no education';
echo strstr($myString, ' ', true);
/*
* output :
* We
*
* I'm expecting to get :
* education
*
*/
exit;
?>
Very Simple !
You have the function strrchr
$myString = 'We don\'t need no education';
echo strrchr($myString, ' ');
// output : ' education'
echo substr(strrchr($myString, ' '), 1);
// output : 'education'