In PHP I have an array that looks like this:
$array[0]['width'] = '100';
$array[0]['height'] = '200';
$array[2]['width'] = '150';
$array[2]['height'] = '250';
- I don't know how many items there are in the array.
- Some items can be deleted which explains the missing [1] key.
I want to add a new item after this, like this:
$array[]['width'] = '300';
$array[]['height'] = '500';
However the code above don't work, because it adds a new key for each row. It should be the same for the two rows above. A clever way to solve it?
An alternative solution would be to find the last key. I failed trying the 'end' function.