The internal pointer of an array
I discovered recently that if you walk through an array using array_walk or array_walk_recursive, then the array's internal pointer is left at the end of the array. Clearly this isn't something that I've needed to know before! This code example shows the fundamentals: $var = [ 'a' => 'a', 'b' => 'b', ]; array_walk($var, function ($value) { }); var_dump(key($var)); The output is NULL and you use reset() to put the internal pointed back to the… continue reading.