Rithu Psks
Rithu Psks

Reputation: 92

How to get the particular value of key by giving the key name?

Array
(
    [0] => stdClass Object
    (
        [domain] => alphaanalysis.org
        [status] => available
    )
}

I have the array and it's elements like this. I just need the value of domain key. How to get that, I don't know. Please help me.

Upvotes: 0

Views: 81

Answers (3)

som
som

Reputation: 4656

<?php
     $array[0]->domain; 
 ?>

If your array is $array then you can try this.

Upvotes: 2

Daxen
Daxen

Reputation: 527

Just use this syntax for that

$arraynem[]->key;

Upvotes: 1

slashingweapon
slashingweapon

Reputation: 11317

If your array is $x you can use:

$x[0]->domain

Upvotes: 3

Related Questions