extrovertive Posted January 22, 2007 Share Posted January 22, 2007 Anyone know of a quick and efficient script to strip off characters in a string and get the numbers only?For instance, "aabc221" would become 221. Link to comment https://forums.phpfreaks.com/topic/35199-extracting-numbers-only-from-a-string/ Share on other sites More sharing options...
papaface Posted January 22, 2007 Share Posted January 22, 2007 [code=php:0]<?php$string = "aabc221";$change = ereg_replace("[A-Za-z]", "", $string);echo $change?>[/code] Link to comment https://forums.phpfreaks.com/topic/35199-extracting-numbers-only-from-a-string/#findComment-166209 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.