How to remove numbers from the end of a string in php
2 answers
Have a look at using preg_replace.
$someString = "1111 this is my string with numbers at the start, in the middle 5555, and at the end 11134";
$newString = preg_replace("/\d+$/","",$someString);
echo $newString;
This will show you:
1111 this is my string with numbers at the start, in the middle 5555, and at the end
+18
source to share