[Solved] I have a string : good morning*12, i want to show like this good morning and remove the numeric value included with “*”, [closed]


There are a couple of ways to do this:

using explode()

$old_string = "good morning*12";
$array = explode("*", $old_string);
$new_string = $array[0];

using preg_replace()

$old_string = "good morning*12";
$new_string = preg_replace("/\*.*/", "", $old_string);

1

solved I have a string : good morning*12, i want to show like this good morning and remove the numeric value included with “*”, [closed]