PHP split string into integer element and string

Posted by David19801 on Stack Overflow See other posts from Stack Overflow or by David19801
Published on 2010-12-27T10:17:37Z Indexed on 2010/12/27 10:53 UTC
Read the original article Hit count: 184

Filed under:

Hello,

I have a string say: Order_num = "0982asdlkj"

How can I split that into the 2 variables, with the number element and then another variable with the letter element in php?

The number element can be any length from 1 to 4 say and the letter element fills the rest to make every order_num 10 characters long in total.

I have found the php explode function...but don't know how to make it in my case because the number of numbers is between 1 and 4 and the letters are random after that, so no way to split at a particular letter. Please help as specifically as possible!

© Stack Overflow or respective owner

Related posts about php