james Oduro james Oduro - 1 year ago 106
PHP Question

Split string into variables

I have the following string:


The first 10 character represents something to me so I split it using the
function 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?

$id = 48

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