array identifying
Posted: Wed Mar 23, 2005 2:06 am
i have a question.
for example in a loop we use an array, we add some info in this array.
Now, is it better/faster to identify that $array is an array before we put it in that loop?
I tried to make a test but first results were faster than identifying or am I mistaken?
It was a surprise for me too because I used alwas the second one.
Thanks,
for example in a loop we use an array, we add some info in this array.
Code: Select all
<?php
// just an example
for($i=0; $i<10000; $i++)
{
$array[] = $data[$i];
}
?>Code: Select all
<?php
// just another example
$array = array();
for($i=0; $i<10000; $i++)
{
$array[] = $data[$i];
}
?>It was a surprise for me too because I used alwas the second one.
Thanks,