2 ms·
> On the other hand, the PHP devs changing the ternary would cause major problems for anything that uses it. If you read the thread, no one could actually reca
by leeoniya 10y ago
> On the other hand, the PHP devs changing the ternary would cause major problems for anything that uses it.
If you read the thread, no one could actually recall having ever seen code that relies on the current behavior. It has been discouraged in the docs for years. The stop-gap proposal was to have PHP7 deprecate it with a warning rather than silently changing the behavior. Then change the behavior in a future version (say php 8).
Disregarding any of that, this is an admitted language bug. It was not ever meant to work this way. Do you have a list of languages where ternary works backwards? PHP devs don't just work in PHP. Having one C-style language work this way and another C-style language (js) in another editor tab work the opposite way is a major PITA.
- totony 10y agoI'd rather they don't change it. I like my code to not stop working (python3, perl 6) when upgrading. Also it's not a bug, more like a design oversight that doesn't cause any problem if you rtfm
- leeoniya 10y ago> doesn't cause any problem if you rtfm unfortunately, that's PHP's mantra for unexpected/inconsistent behavior (of which there is a plethora)