note 126351 deleted from closure.call by cmb
| From: | cmb@php.net | Date: | Thu, 19 Aug 2021 10:41:36 +0000 |
| Subject: | note 126351 deleted from closure.call by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-216807@lists.php.net to get a copy of this message | ||
Note Submitter: php-net at gander dot pl
----
You can also access private data:
<?php
class Value {
private $value;
public function __construct($value) {
$this->value = $value;
}
}
$foo = new Value('Foo');
$bar = new Value('Bar');
$closure = function () { var_dump($this->value); };
$closure->call($foo);
$closure->call($bar);
?>
Output:
string(3) "Foo"
string(3) "Bar"