Weird things with the PHP Ternary Operator
$amenities = $amenities = AmenityOutput::generate_list_output($object->get_amenities()) ? $amenities : “None available”;
Yes, that apparently is valid PHP. :sick:
I switched it to this:
$amenities = AmenityOutput::generate_list_output($object->get_amenities());
if (!$amenities) $amenities = “None available”;
Sometimes people are too clever.
The ugliness of this piece of code combined with the fact that it actually works, the whole idea is so wrong that it’s not even funny. Yet the PHP inventors expect people to accept this parsing behaviour. It’s as though the PHP interpreter is allowed to parse at arbitrary greediness. “Thanks for the inconsistency, you PHP fucktards.”
Another reason for me to stay away from PHP.
Kal
March 28, 2009
[...] my friend Jawaad showed me an interesting piece of ugly PHP code. I reiterated the fact that PHP sucks and that it remains trolling the web application development [...]
PHP Kiddies « Kalunite.net
March 28, 2009