Re: Check Variable with true or not

From: Date: Mon, 29 Sep 2008 11:51:28 +0000
Subject: Re: Check Variable with true or not
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-281090@lists.php.net to get a copy of this message
Maciek Sokolewicz wrote:
Carlos Medina wrote:
Hi @ all: Question: what is quickly? if( true == isset( $var ) ){} or if( isset( $var ) ){} Can somebody explain ( not think or believe ), what happend on the Zend Engine when the first or the second code will be use? Regards Carlos
The _exact_ same thing happens. #1 (with the == true) results in an extra opcode compared to the other, thus making it a very very very tiny bit "slower". But other than that, there is _no_ difference _at all_. And trust me, you won't see _any_ difference in execution time by changing the first into the other, it's so infintissimally tiny. - Tul
may as well point out that === would be more suited than == in most cases (doesn't make much difference with isset) nath

« previous php.general (#281090) next »