PHP count() Function


$songs=array(“Bootleg Man“,”Oooh“,”Satin Jazz“,”Once I Hold You“);

echo count($songs);

The result of the count() function in the above example, will be 4.


PHP sizeof() Function

$songs=array(“Rhythm And Smooth“,”What I Think Of You“,”Journey“,”Give Me What You Got“);
echo sizeof($songs);

The result of the sizeof() function in the above example, will be 4.

In almost any useful or complex php application, there will likely be a reason to count an array. Since an array is simply a list of items, words, etc., how could this function be useful to you as a php programmer or web developer?

When it comes to earning money, or creating a useful php application in the competitive marketplace, “why” you code, is just as important, as “how” you code.