How can I remove, with PHP, the last word from a String?
For example the string \"Hi, I\'m Gian Marco\" would become \"Hi, I\'m Gian\".
\"Hi, I\'m Gian Marco\"
\"Hi, I\'m Gian\"
This code may help you :
$str="Hi, I'm Gian Marco"; $split=explode("",$str); $split_rem=array_pop($split); foreach ($split as $k=>$v) { echo $v.''; }