Answer the question
In order to leave comments, you need to log in
How to enumerate an array?
I get an array of properties, I need one value for each element from there. I'm new to php, I just didn't write like that, I've just been struggling with this for 3 hours, in total I got this
How do I number the first level array so that I can access it?
It should look like this:
(for example 3 array)
[3]=>Array
(
[0]=>1
[1]=>10
[2]=>2
[3]=>20
[4]=>31
[ 5]=>16
[4]=>Array (etc.)
If you help I will be very grateful
Answer the question
In order to leave comments, you need to log in
I don't understand shit, so I'll answer as I understand.
$array = [1, -20, 'tango', 'whiskey',];
/* echo $array[0]; // 1
* echo $array[1]; // -20
* echo $array[2]; // tango
* echo $array[3]; // whiskey
*/
$array = ['foo' => 'bar', 'baz' => 27,]
/* echo $array[0]; // bar
* echo $array[1]; // 27
* echo $array['foo']; // bar
* echo $array['baz']; // 27
*/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question