Skip to content

Tag: php

how to create dynamic array?

how to create a dynamic array? I need to set the dynamic value of product id and qty and passing into the items array. $itemarray = []; foreach ($ItemCollection as $item) { $productId = $item[‘…

PHP behaving strange in for loop with associative array

the attached image is self-explanatory. I think its not new, but i’d like to understand the details behind it. So to summarize my problem, when an associative array, that has only string keys, is passed to a basic for loop, it overflows, when i assign a value to one of its – previously non existan…