I’m sure this conversation has happened before. But it’s on my mind as I work on some things on wanted to ask internals real quick before getting back to it.
[“2” => “hello”, “4” => “internals”] -> [2 => “hello”, 4 => “internals”] Meanwhile: [“hello”, “internals”] -> cast to object -> (“0” => “hello”, “2” => “internals”) Curious why this it’s the case that specifically requesting a string be a key that happens to be an integer, becomes an int type. I kind of understand why in the case of object the implicit (PHP-established) integers become strings. And, of course, casting back puts us back to an indexed array. I’ve picked up that type juggling might be a touchy point - but the focus is on why the key gets cast at all when it’s an array type. Is it to facilitate the type juggle from an object to an array?? Cheers, Josh -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php