1 0 Tag Archives: string
post icon

How to remove part of string after certain character in php?

$title = array_shift(explode(‘_’, $title));
where $title is string having complete text including ‘_’ , so it will remove any thing after ‘_’ including ‘_’.

Leave a Comment
post icon

How to get string from the last occurrence of the space in the string?

$string = substr($row[vodtitle],0,40);
$string = str_replace("-","",$string);
echo substr($string, 0, strrpos( $string, ' ') ); //Hello World
Leave a Comment