Skip to content
Advertisement

How can I get specific value in array

I will explain clearly

JavaScript

In this two dimension are

JavaScript

I know $a value and $b is unknown

If I using $a =1, I want to filter array(0 =>"aa",1 =>"bb", 2 => "cc",3=>"dd") this array

But I need to get the second array element. Any function is available to do that?

Advertisement

Answer

This is how you do it:

JavaScript

This outputs:

b

And then it outputs:

Array ( [1] => a [3] => c )

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