On 3 January 2022 16:07:53 GMT, Chase Peeler <chasepee...@gmail.com> wrote: >My mistake, I thought it did get casted. Still, I think you add a lot of >complexity because you'll need to keep track of whether or not a key was a >string or not. There is no guarantee that all numeric keys were originally >a string: >[ "1" => "foo", 2 => "bar"]
I don't think anybody was proposing any such tracking, simply a shorthand for this: array_map(strval(...), array_keys($array)); In other words, take the keys of any array, which might be a mixture of integers and strings, and convert them all to strings, regardless of how they were originally specified. The result being an array where the values can all be safely passed to a function expecting strings, with strict_types=1 in force. Regards, -- Rowan Tommins [IMSoP] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php