Re: literal strings vs variable strings

From: Date: Thu, 13 Aug 2009 14:17:28 +0000
Subject: Re: literal strings vs variable strings
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-296743@lists.php.net to get a copy of this message
I dont think so, because PHP is an interpreter, the string 'something' has to be extracted and then be put in memory after that the code will compare the two memory locations. doesnt give me any benefit. however, comparing strings with the '==' does involve case sensitivity and also leading or trailing spaces will guide to not equal. thats why I prefere the comparison functions anyway "Martin Scotta" <martinscotta@gmail.com> wrote in message news:6445d94e0908130702v4c2e5b77xe4b891546cc852c2@mail.gmail.com... > Hi all. > > Is this going to save me anything? > > <?php # literal > foreach($items as $item) > if( 'something' == $item->something() ) > return true; > > <?php # variable > $something = 'something'; > foreach($items as $item) > if( $something == $item->something() ) > return true; > > -- > Martin Scotta >

« previous php.general (#296743) next »