Hi Miroslav & Arnaud,
On 09/11/11 12:51, Miroslav Kubelík wrote:
On 10/14/2011 10:08 PM, Arnaud Le Blanc wrote:
Hi,
I've already posted this patch and it has since been reviewed and
improved.
I'm re-posting it for discussion before eventually commiting it.
The ternary operator always copies its second or third operand, which
is very
slow compared to an if/else when the operand is an array for example:
...
Same "copy always" behavior is made with string in ternary operator, and
it can be
also very annoying e.g:
$content =
file_get_contents('http://www.w3.org/TR/2011/WD-html-markup-20110525/spec.html');
$test = $content !== false ? $content : '';
Is it the same with: $content = file_get_contents('…') ?: ''; Maybe we
could have a heuristic for this shortcut operator no?
Best regards.
--
Ivan Enderlin
Developer of Hoa
http://hoa.42/ or http://hoa-project.net/
PhD. student at LIFC/DISC (Vesontio) and INRIA (Cassis)
http://lifc.univ-fcomte.fr/ and http://www.inria.fr/
Member of HTML and WebApps Working Group of W3C
http://w3.org/
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php