I have tried a few things to get a last part out I done this:
$string = \'Sim-only 500 | Internet 2500\';
preg_replace(\"Sim-Only ^([1-9]|[1-9][0-9]|[1-9][0-
There you go a generic function to get last words from string
public function get_last_words($amount, $string)
{
$amount+=1;
$string_array = explode(' ', $string);
$totalwords= str_word_count($string, 1, 'àáãç3');
if($totalwords > $amount){
$words= implode(' ',array_slice($string_array, count($string_array) - $amount));
}else{
$words= implode(' ',array_slice($string_array, count($string_array) - $totalwords));
}
return $words;
}
$string = 'Sim-only 500 | Internet 2500';
echo get_last_words(1, $string );