Re: literal strings vs variable strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx> wrote in message
news:6445d94e0908130702v4c2e5b77xe4b891546cc852c2@xxxxxxxxxxxxxxxxx
> 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
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux