I'm in the process of migrating an old piece of code to PHP 8.1 from (hold on to your hat...) PHP 4.2!
However I did make significate progress. I ran in to the following statement
if ($arr[$key]) {
array_splice($arr[$key]);
}
var_dump shows
$key = 'a';
$arr = ['a' => 1];
Obviously this breaks on 8.1 for 2 reasons
- int is passed as an array.
- offset is ignored.
I'm having trouble under standing what would have been the behavior of this code under PHP 4.2
Looking at the 4.x documentation of array_splice
does not explain.
Thank's