seperating a string

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shoaib
Forum Newbie
Posts: 5
Joined: Wed Feb 18, 2009 10:17 am

seperating a string

Post 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
jason.carter
Forum Commoner
Posts: 35
Joined: Sat Jan 10, 2009 10:05 am

Re: seperating a string

Post by jason.carter »

Try simple
$numbers = ereg_replace("[^0-9]", "", $string);
$characters = ereg_replace("[^A-Za-z]", "", $string);

done.
Post Reply