Possible Duplicate:
Special characters in property name of object
I'm parsing a JSON response from MediaWiki's API: Requested URL
I run it through json_decode()
and then pull some pieces of it. The problem I have is that the attribute name for the content is *
. I get a PHP error when I try to access the content ( the 140,950 character string at the end of my vardumped json_decoded example below ) like this:
foreach( $Response->query->pages as $page_id => $Page ) {
$this->id = $Page->pageid;
$this->title = $Page->title;
$this->content_with_markup = $Page->revisions[0]->*;
}
The PHP Error: PHP Parse error: syntax error, unexpected '*'
The pageid
and title
work fine.
Here is the piece of JSON_Decoded object that is giving me problems:
object(stdClass)#5 (1) {
["11968"]=>
object(stdClass)#6 (4) {
["pageid"]=>
int(11968)
["ns"]=>
int(0)
["title"]=>
string(17) "George Washington"
["revisions"]=>
array(1) {
[0]=>
object(stdClass)#7 (2) {
["contentformat"]=>
string(11) "text/x-wiki"
["*"]=>
string(140950) "{{About|the first President of the United States|other uses}}...
How do I access the content contained in the attribute named *?