Skip to content
Advertisement

Tag: key

php can not get array value from an array

I have an array: And I would like to get the first value in the array: I have tried each of the following: array_values($_array)[0]; $data[0]; array_keys($data)[0]; But none of them work, and I instead get an empty string. I need to get the first element or key of the array. Answer you can use array_key_first(your_array) Get the first key of

Advertisement