What I am trying to do is remove a *
and the number after it from a string.
$string = 'something*10';
$string2 = 'something*1';
needs to output
something
something
not
something*10
something*1
You can use preg_replace with this regular expression /\*\d+/
to solve your problem.
The other answers assume that the * are followed by numbers which is incorrect based on your requirement.
As found here : REF
Running Example : IDEONE