News for hackers. Stuff that matters.
Re:Upcoming changes in PHP 7.1 by oneeyedpigeon on Monday May 23, 2016 @09:21AM (#11753639)
Wow. OK, I am a big user of the ternary operator, but I hadn't come across omission of the middle part until now. To be honest, it's not the most accessible syntax (especially if you're coming from another language), but at least I have the option now - thanks!

edit: Just to clarify for anyone else unfamiliar with it:

    $ php -r 'var_dump(42 ?: 0);'
    int(42)
Re:Upcoming changes in PHP 7.1 by rbritton on Monday May 23, 2016 @12:17PM (#11754803)
Depending on how far back you have to support (e.g., WordPress is still supporting 5.2), omission of the middle part wasn't supported until PHP 5.3.
Re:Upcoming changes in PHP 7.1 by TazeTSchnitzel on Monday May 23, 2016 @04:02PM (#11756466)
5.3 came out seven years ago and isn't even officially supported by the PHP project now, let alone 5.2.
Re:Upcoming changes in PHP 7.1 by rbritton on Wednesday May 25, 2016 @01:09PM (#11771338)
I know all too well, and you'd never catch me running that on any of my own systems. With a large enough install base, it's not uncommon to have a decent number of people on those older versions though.