The count function counts all of the elements in an array.

    
    $cars = array("Volvo","BMW","Toyota","Ford");

    $count_cars = count($cars);

    echo $count_cars;
    // 4