Domanda

My object name is $distinct1

print_r($distinct1) shows the object below but when I try to do

echo $distinct1->properties->city

OR

echo $distinct1->distinct_id

I don't get any value return. Any idea whats going on?

stdClass Object
(
    [$distinct_id] => AAA
    [$properties] => stdClass Object
        (
            [$city] => Palo Alto
            [$country_code] => US
            [$region] => California
            [$name] => John Smith
)
)
È stato utile?

Soluzione

Hm, if your properties are really named like that:

$distinct1->{'$properties'}->{'$city'}

But if possible, I'd look into the mechanism that sets it like that & fix it there.

Altri suggerimenti

The property names of that object actually start with $ for whatever weird reason.

echo $distinct1->{'$properties'}->{'$city'};
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top