Difference between count() and sizeof() in PHP
difference between count and sizeof
According to PHP documentation, sizeof()
is an alias of count()
. While searching on the web, I found and realized that count()
is faster and butter than sizeof()
. Here is a good description of this on stackoverflow– scroll down to the answer of Gazoris. to understand the difference between count() and sizeof() in php
According to my understanding when sizeof is an alias of count, its code might be looking something like this.
count()
Function:
sizeof()
Function:
The above example code describes that when you are using sizeof()
you are also calling the count()
via backdoor. So, use of count is better.