note 98774 added to language.operators.string

From: Date: Wed, 07 Jul 2010 03:01:08 +0000
Subject: note 98774 added to language.operators.string
Groups: php.notes 
Request: Send a blank email to php-notes+get-170746@lists.php.net to get a copy of this message
Hi I'm newbie on this.... Please help me up with that example at kevin at metalaxe dot com !!!!! ----------------------------------------------------------- I ran the follow script and found that using "$var" was 'mostly' slower than using ' '.$var <?php $var = 1; for( $x=0; $x < 101; $x++ ) { echo '<br /><br />var = int( '.$var.' )<br />'; $timer->reset(); for( $i=0; $i<100001; $i++ ) { $string = " {$var} {$var} {$var} {$var} {$var} {$var} {$var} {$var} {$var} {$var} {$var} {$var} {$var} {$var} {$var}"; unset( $string ); } echo 'One string with 15 $vars was set using one concat 100000 times and took '.$timer->fetch_time().' seconds to execute <br />'; $timer->reset(); for( $i=0; $i<100001; $i++ ) { $string = ' '.$var.' '.$var.' '.$var.' '.$var.' '.$var.' '.$var.' '.$var.' '.$var.' '.$var.' '.$var.' '.$var.' '.$var.' '.$var.' '.$var.' '.$var; unset( $string ); } echo 'One string with 15 instances of $var was set using multiple concats 100000 times and took '.$timer->fetch_time().' seconds to execute'; } exit(); ?> "Replacing $timer with a generic timing class of course." ------------------------------------------------------------------ I don't what taking about :-( Thank a lot.... ---- Server IP: 69.147.83.197 Probable Submitter: 190.78.60.208 ---- Manual Page -- http://www.php.net/manual/en/language.operators.string.php Edit -- https://master.php.net/note/edit/98774 Del: integrated -- https://master.php.net/note/delete/98774/integrated Del: useless -- https://master.php.net/note/delete/98774/useless Del: bad code -- https://master.php.net/note/delete/98774/bad+code Del: spam -- https://master.php.net/note/delete/98774/spam Del: non-english -- https://master.php.net/note/delete/98774/non-english Del: in docs -- https://master.php.net/note/delete/98774/in+docs Del: other reasons-- https://master.php.net/note/delete/98774 Reject -- https://master.php.net/note/reject/98774 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#170746) next »