Suppose you key value array and your using foreach i have done one more optimization.
I am using while loop.
$array = array('first'=>'max','second'=>'pain');
foreach($array $key=>$value)
{
print 'Key: ' . $key . ' Value: ' . $value ;
}
=====Optimized Code=====
while(list($key,$value)=each($array))
{
print 'Key: ' . $key . ' Value: ' . $value ;
}
=====Optimized Code=====
The while loop runs more faster then foreach.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment