04-23-2009, 09:39 AM
|
#17 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
|
Quote:
Originally Posted by allworknoplay
I'll look into the object literal, that doesn't look like it's something that is available in PHP right?
Sounds pretty cool though, almost like a shortcut to using objects...
|
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.
Quote:
Originally Posted by allworknoplay
On your last explanation:
++retval[…]
Would that be considered a unary operator?
|
Yep, because the operator acts on only one variable, it is a unary operation.
Quote:
Originally Posted by allworknoplay
You have a PHP.net account! You can make it happen!!
|
PHP is an open source project, meaning anyone is free to contribute. A php.net account is not required! 
|
|
|
|