RE: Whacky increment/assignment logic with $foo++ vs ++$foo

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

 




> Does these behaves exactly?
> for($i=0; $i<10; ++$i)
> for($i=0; $i<10; $i++)

different benchmarks showed ++$i is usually faster than $i++
In that loop case, yes, what's happen internally is exactly the same, $i will be from 0 to 9, in the other case obviously is not the same.

but pre increment and post increment are truly basic stuff ... I don-t see all this need to study the case, it's pretty simple, as is that operation, in PHP.

In other languages, could have been the same, rarely in scripting languages though, at least those with still primitive scalar values (int, float, string, bool)

Regards
 		 	   		  
_________________________________________________________________
Windows Live Hotmail: Your friends can get your Facebook updates, right from Hotmail®.
http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_4:092009

[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