I have this code snippet:
var_dump(count($xml)); // returns 34
for($i = 8; $i < count($xml); $i++){
echo "unseting $i <br>";
unset($xml[$i]);
}
var_dump($xml);
Result:
int 34
unseting 8 unseting 9 unseting 10 unseting 11 unseting 12 unseting 13 unseting 14 unseting 15 unseting 16 unseting 17 unseting 18 unseting 19 unseting 20
Why is this for breaked at $i = 20 ?
When i change for-loop for $i = 0 - it's still works anomaly. I get only number 0-16 - simply always only half. But when i comment unset line - then it's iterate over all values..
Where can be problem in unset? Why unset breaking my for at half?
$xmlin your loop