Why ternary operator doesn't work with assignment by reference?
$obj = new stdClass(); // Object to add
$result = true; // Op result
$success = array(); // Destination array for success
$errors = array(); // Destination array for errors
// Working
$target = &$success;
if(!$result) $target = &errors;
array_push($target, $obj);
// Not working
$target = $result ? &$success : &$errors;
array_push($target, $obj);
Here you go
Also your example has two typos
edit
http://php.net/manual/en/language.operators.comparison.php
idk if this worked before, but it doesn't anymore. if you don't wanna use an if statement, then try this:
or on separated lines ...