How to use each and list in a multidimensional array

Asked

Viewed 16 times

0

I need to go all the way array multidimensional with each and list only. This is the code:

$Carros = array(
    array("BMW", 130000, "Novo"),
    array("Strada", 40000, "Usado"),
    array("CRUZE", 100000, "Semi-novo")
);
  • And as you tried to do?

  • Well, I know how to do it in a simple array, but in a multidimensional array, I have no idea how to do it. I did some research and didn’t find much, so I would like to know how it works in a multidimensional array

  • You will need to make two loops: one to traverse the values of $Carros, another to traverse all values of each line of $Carros.

  • I use two eachs for this?

  • Yes, in separate loops.

  • There’s a way I can do this without looping loop

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.