PHP remove all characters before specific string
You can use strstr to do this.
echo strstr($str, 'www/audio');
Considering
$string="We have www/audio path where the audio files are stored"; //Considering the string like this
Either you can use
strstr($string, 'www/audio');
Or
$expStr=explode("www/audio",$string);
$resultString="www/audio".$expStr[1];
I use this functions
function strright($str, $separator) {
if (intval($separator)) {
return substr($str, -$separator);
} elseif ($separator === 0) {
return $str;
} else {
$strpos = strpos($str, $separator);
if ($strpos === false) {
return $str;
} else {
return substr($str, -$strpos + 1);
}
}
}
function strleft($str, $separator) {
if (intval($separator)) {
return substr($str, 0, $separator);
} elseif ($separator === 0) {
return $str;
} else {
$strpos = strpos($str, $separator);
if ($strpos === false) {
return $str;
} else {
return substr($str, 0, $strpos);
}
}
}