I have folowing string:
$html .= '<img src="' . $url . '" alt="' . trim($alt) ? $alt : $this->escape($name) . '" />';
Which looks ok from first glance but it will append empty string to $html
which took some head scratching..
But if I add parenthesis around ternary operator it returns expected result
$html .= '<img src="' . $url . '" alt="' . (trim($alt) ? $alt : $this->escape($name)) . '" />';
My question how does parser parse this expresion that it's possible to get nothing appended to the result?