Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php count vs sizeof

//pre-calculate the size of array
$size = count($x); //or $size = sizeOf($x);

for ($i=0; $i<$size; $i++) {
    //...
}

//don't pre-calculate
for ($i=0; $i<count($x); $i++) { //or $i<sizeOf($x);
    //...
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #count #sizeof
ADD COMMENT
Topic
Name
6+5 =