Page 1 of 1

seperating a string

Posted: Wed Feb 18, 2009 10:25 am
by shoaib
hello

i m new to php , i want to create a function when any string passed through the form , i want to seperate this string and integar and echo it seperately


I mean if a value is send through a rbs123 or kml23rb

i want that the function seperate (rbs and 123) and also (23 and kmlrb)

i m waiting for the reply , i will be very grateful

thanks
shoaib

Re: seperating a string

Posted: Wed Feb 18, 2009 11:43 am
by jason.carter
Try simple
$numbers = ereg_replace("[^0-9]", "", $string);
$characters = ereg_replace("[^A-Za-z]", "", $string);

done.