Closed abbychau closed 4 years ago
Hi @abbychau,
Is there a typo in your snippet above? I've just run this through both Zend's PHP engine and Uniter and it gives the same output, just d
.
In your snippet, on the first (and only) iteration of the loop $v
will be dafdsf
and so $v['test']
tries to fetch an element at index 'test'
of that string, which raises a warning and just fetches d
(as the string 'test'
is cast to a 0, so it just fetches the character at index 0).
I've tried a similar snippet, wrapping the array again eg.
<?php
$k=[
['test'=>'dafdsf']
];
foreach($k as $v){
echo $v['test'];
}
?>
and that gives the same output in both engines (dafdsf
).
Hope this helps!
ah, I made a mistake :p sorry
expected: 'dafdsf' now: 'd'