Hi all,
I have a field in the database where i need to take out any alpha at the end of a string and just keep the numbers. so for example i have:
"123 4 56778 hello"
I want to takeout any alpha nd keep numbers, how can i do this and display "123 4 56778"
using eregi
Moderator: General Moderators
- icarpenter
- Forum Commoner
- Posts: 84
- Joined: Mon Mar 07, 2005 8:12 am
- Location: Kent, England
Try...
Give this a try!
Code: Select all
$string = "123 4 56778 hello";
$test=ereg_replace("[A-Z a-z]", "", $string);
echo"$test";