note 107755 added to language.types.object
| From: | qeremy | Date: | Fri, 02 Mar 2012 00:41:03 +0000 |
| Subject: | note 107755 added to language.types.object | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-186457@lists.php.net to get a copy of this message | ||
Do you remember some JavaScript implementations?
// var timestamp = (new Date).getTime();
Now it's possible with PHP 5.4.*;
<?php
class Foo
{
public $a = "I'm a!";
public $b = "I'm b!";
public $c;
public function getB() {
return $this->b;
}
public function setC($c) {
$this->c = $c;
return $this;
}
public function getC() {
return $this->c;
}
}
print (new Foo)->a; // I'm a!
print (new Foo)->getB(); // I'm b!
?>
or
<?php
// $_GET["c"] = "I'm c!";
print (new Foo)
->setC($_GET["c"])
->getC(); // I'm c!
?>
----
Server IP: 69.147.83.197
Probable Submitter: 85.108.67.192
----
Manual Page -- http://www.php.net/manual/en/language.types.object.php
Edit -- https://master.php.net/note/edit/107755
Del: integrated -- https://master.php.net/note/delete/107755/integrated
Del: useless -- https://master.php.net/note/delete/107755/useless
Del: bad code -- https://master.php.net/note/delete/107755/bad+code
Del: spam -- https://master.php.net/note/delete/107755/spam
Del: non-english -- https://master.php.net/note/delete/107755/non-english
Del: in docs -- https://master.php.net/note/delete/107755/in+docs
Del: other reasons-- https://master.php.net/note/delete/107755
Reject -- https://master.php.net/note/reject/107755
Search -- https://master.php.net/manage/user-notes.php