Sometime developers are facing the issue of eliminating all characters before the first specific character. Here I am describing how you can remove all the characters before a specific thing. Just suppose we have a string as below:- <?php $str = ‘http://blog.phpmypassion.com’; ?> Now If I want to get my main domain then I have to follow below code.. <?php if(($pos = strpos($str, ‘.’)) !== false) { $new_str = substr($str, $pos + 1); } else { $new_str = get_last_word($str); } echo ‘new string will be=’.$new_str; ?>…
