You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
filter() and Functional PHP in general tries to preserve keys whereever possible. As I am guessing you are doing json_encode() on the data, do array_values(json_encode()) if you want to force a list as a result. json_encode() encodes an array as an object if there is no index 0, array_values() can fix that for you.
Say we have a
$towns
array:The following
returns an array of items keyed by the original position:
but comparing greater than
-1
returns the expected structure
Any thoughts?
The text was updated successfully, but these errors were encountered: