D
D
danforth2016-06-12 10:47:56
PHP
danforth, 2016-06-12 10:47:56

How to access the property of an object if it has a similar name?

I unload posts through the API, then I do json_decode, at the output I get a mess of StdObjects and arrays, one of the object properties has the name 'wp:featuredmedia', which contradicts the rule for naming variables (array elements and object properties)
94d1b54a24eb4e5495c9963591f3bf17.png
Then how to access it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anatoly, 2016-06-12
@danforth

$obj->{"some strange name"} methods also work

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question