On 2/3/06, Keith Proctor <keith_proctor@xxxxxxxxxxxxx> wrote: > I need to add two numbers together, unfortunately one of them is a > string that starts with a character. I'd like to convert a string > such as 'x5' to the number 5. Don't care about it's final type as > that isn't the hard part. :) I can't find a function to do this. I > looked in the math class and in the string class and there doesn't > seem to be something to help. I, of course, could write something to > handle it but I would prefer to use something built in. Any help > would be appreciated. preg_replace("/[^0-9]/", "", $x) I would expect intval to work as well, but aparently not. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php