View Single Post
Old 04-23-2009, 10:17 AM   #18 (permalink)
Kalle
The Frequenter
Zend Certified 
 
Join Date: Sep 2007
Location: Denmark
Posts: 352
Thanks: 8
Kalle is on a distinguished road
Default

Quote:
Originally Posted by Salathe View Post
No, as Kalle said, object literals are not in PHP (yet). The closest thing, visually, that I can think of would be:

PHP Code:
$retval = (object) array(
  
'checkbox' => 0,
  
'radio'    => 0,
  
'total'    => 0
);

++
$retval->total;
print_r($retval); 
The ArrayObject (in PHP) would also allow the object- and array-syntaxes to be used ($retval->total and $retval['total']) if you wanted/needed them both.


Yep, because the operator acts on only one variable, it is a unary operation.


PHP is an open source project, meaning anyone is free to contribute. A php.net account is not required!
Exactly (about the last part), however I do have commit access to php-src, but my skills digging into ZE is abit too poor, but the API is pretty straight forward ;)

As for the ArrayObject, any class that implements the ArrayAccess interface should be able to be accessed like arrays and objects :)
__________________
Send a message via MSN to Kalle Send a message via Skype™ to Kalle
Kalle is offline  
Reply With Quote