Explain this please :)
If I run
$custId = getExternalId();
echo $custId . "
"; // Prints foobar_16262499_1
$serial = '';
$custId = explode('_', $custId);
var_dump($custId);
$custId = $custId[1];
$serial = $custId[2];
die("custId: $custId serial: $serial
");
I get
custId: 16262499 serial: 2
This is not correct. Serial should be 1. But if I change the order of assignment to
$custId = getExternalId();
echo $custId . "
"; // Prints foobar_16262499_1
$serial = '';
$custId = explode('_', $custId);
var_dump($custId);
$serial = $custId[2]; // Change order here!!!
$custId = $custId[1];
die("custId: $custId serial: $serial
");
It works and gives me
custId: 16262499 serial: 1
WHY?
In both cases the var_dump of the array produces the same output:
array(3) {
[0]=>
string(4) "foobar"
[1]=>
string(8) "16262499"
[2]=>
string(1) "1"
}
I'm running PHP/5.3.3 ZendServer
SMACKS HEAD... How could I miss the obvious :)...