1
I have this array and want to put on the screen the string "Banana".
$frutas = array (
"frutas" => array("a"=>"Laranja", "b"=>"Banana", "c"=>"Maçã"),
"numeros" => array(1, 2, 3, 4, 5, 6),
"buracos" => array("primeiro", 5 => "segundo", "terceiro")
);
How can I do that?
You have a array of arrays. You know how to work with arrays? Because it wasn’t very clear exactly what the problem is. Do you want to know just how you access a specific value? Have you read the documentation on array?
– Woss
No, I don’t know, I’m studying, I can ask this question here or is it too simple?
– Léo Cunha
You can, no problem. I only ask because it is difficult to infer the level of knowledge of the questioner and when it is not so clear what is being asked, it becomes confused. You quote the second value and then says that you need a value of a array associative. This doesn’t make much sense because PHP doesn’t guarantee the order of a array associative, then the second value could vary. But yes, feel free to create a question whenever you need.
– Woss
So I can’t get exactly the second value? Cool, I learned one more thing, vlw.
– Léo Cunha
How can I send you a question I have directly?
– Léo Cunha
In that case, banana would be the value associated with the key b of array that is associated with the key fruit of
$frutas
, not necessarily the second value (visually is the second, but not necessarily in memory).– Woss
Can enter the chat Stack Burst.
– Woss