class Number {
private $v;
private static $sv = 10;
public function __construct($v) { $this->v = $v; }
public function mul(){
return static function ($x) {
return isset($this) ? $this->v * $x : self::$sv * $x;
};
}
}
$one = new Number(1);
$two = new Number(2);
$double = $two->mul();
$x = Closure::bind($double, null, 'Number');
echo $x(5);
upvoted 6 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
ZhukovPeter
Highly Voted 4 years, 10 months ago