RE: [PHP-DEV] [Proposal] Modification to ?: functionality

From: Date: Tue, 26 Nov 2013 19:53:38 +0000
Subject: RE: [PHP-DEV] [Proposal] Modification to ?: functionality
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-70428@lists.php.net to get a copy of this message
-----Original Message----- From: Peter Cowburn [mailto:petercowburn@gmail.com] Sent: Tuesday, November 26, 2013 10:50 AM To: Jannik Zschiesche Cc: Mats Lindh; Chris London; internals@lists.php.net Subject: Re: [PHP-DEV] [Proposal] Modification to ?: functionality On 26 November 2013 15:32, Jannik Zschiesche <hello@apfelbox.net> wrote: > What are your (everyone's) thoughts on the following, given the current topic of discussion? > > $foo = $fo ?: 'default'; // see what I did there? > > I'm not sure changing the ?: to always use isset() is necessarily a good thing given my propensity for tiping mystakes. I don't like this change for exactly the reason Peter pointed out. I also thought about the fact that I often write a utility function to provide this functionality in my own code. The difference there is that I can remove the check and get the notices when debugging something. If this change were part of the language, that wouldn't be possible. Bryan

« previous php.internals (#70428) next »