Re: Re: [RFC Proposal] Null Coalesce Equal Operator

From: Date: Mon, 11 Apr 2016 13:07:05 +0000
Subject: Re: Re: [RFC Proposal] Null Coalesce Equal Operator
References: 1 2 3 4 5 6 7 8 9 10 11 12  Groups: php.internals 
Request: Send a blank email to internals+get-92193@lists.php.net to get a copy of this message
Maybe even more sugar? :) <?php class SugarCache { // Methode getValueFromDB() called, if its value null public $value ??= $this->getValueFromDB(); // Methode getValueFromDB() called, if $value not transmitted or null value public function __construct($value ??= $this->getValueFromDB()) { //... } public function getFromCache() { // Methode getValueFromDB() called, once upon init static $value static $value ??= $this->getValueFromDB(); return $value; } }

« previous php.internals (#92193) next »