I have a forcycle that contains a condition (and an incremental value i):
if(condition)){$arr[$i] = array("value" => $node->nodeValue));}
else{$arr[$i] = array("string" => $node->nodeValue);}
In the end I need to have an array like this:
Array ( [1] => Array ( [string] => abc [value] => 0,999 )
[2] => Array ( [string] => meh [value] => 0,123 )
[x] => Array ( [string] => xxx [value] => xxx ) )
I understand that my code doesn't work, I think I should use array_push, but I was wondering is there are better way to achieve this
Thank you very much