arrays, loops, vars and props
| From: | Jason Davidson | Date: | Wed, 10 Mar 2004 08:25:28 +0000 |
| Subject: | arrays, loops, vars and props | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-179988@lists.php.net to get a copy of this message | ||
Hey, would anyone know offhand, if its faster to create a temp array,
fill it via loop, and then set a class property to that array, or to
simply fill the class property via loop..
to clearify.
would the following example be faster or slower had i simply done
$this->myArray[$i] = $i;
class MyClass {
var $myArray = array();
function MyClass() {
$myTempArray = array();
for($i=0;$i<100;$i++)
$myTempArray[$i] = $i;
$this->myArray = $myTempArray;
}
}
just curious...
Jason