james Oduro james Oduro - 1 year ago 76
PHP Question

Split php string into variables

I have the following string: "157458210148"

the first 10 character represents something to me so I split it using the php substr() like this:

$pin= "157458210148";
$order_num = substr($pin,0,10);

My question is: How do I return the rest of the string and assign it to a variable?

example $id = 48

Thank you.

Answer Source

Here's an alternative to get both at one time:

list($order_num, $other_num)  = str_split($pin, 10);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download