How we can select a string up to specific character in php?
ie I have a string Wednesday 16-January-2013. I need to get only up to first space.
ie output should be Wednesday.
I done it using explode,
<?php
explode(" ",Wednesday 16-January-2013)
?>
But too many explodes and array are permitted in the code. So,
How I can do it without using explode()?
As of PHP 5.3.0 you can use strstr function to return the part of the haystack before the first occurrence of the needle (excluding the needle):