Hello,

ternary operator is very nice syntactic sugar...

   $foo = $cond ? $bar : $baz;

...but it may slows down scripts. When $bar is array or relative big string, it is better to aviod sugar and use if:

   if ($cond) $foo = $bar; else $foo = $baz;

and reference counting will be used.

I don't know how difficult it is to implement, but it can be very useful speed optimization for PHP 5.3 to improve ternary operator to use reference counting.

David Grudl



--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to