ForEach(*$var, ...) (i.e. for a dereferenced array) leads to ERROR 9 | Subscript out of range.
I'm convinced the second should work - especially as the first does?
Example, for string and for array:
Code: Select all
//§ Test ForEach with DeReference
"Test ForEach DeRef : TFEDR"
STEP;
$var = '$p3'; // name of a parameter
*$var = 'this|value';
ForEach($tok, *$var, '|') { // this is OK
echo "tok = $tok";
}
STEP;
$var = '$p4'; // another parameter
Explode(*$var, $p3, '|'); // use previous string for new arrray
ForEach(*$var as $ind => $val) { // ERROR 9 | Subscript out of range
echo "$ind is $val";
}