Skip to content
Advertisement

How to find value?

I make this associative array with PHP.

JavaScript

Now by using array_rand() function =>

JavaScript

The Output is: [0] => a [1] => b

This output shows me only the key of the array. But I want to see the value too. How can I find the value of this array using array_rand()?

Advertisement

Answer

Use the keys to access the original array

JavaScript

RESULT

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement