Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Counts all elements in an array or in a Countable object
Alias sizeof
<?php count(Countable|array $value, int $mode = COUNT_NORMAL): int
<?php     $results = [];

    $errored = false;



    $numTasks = count($tasks);

    if (0 === $numTasks) {

        $deferred->resolve($results);

    }
<?php         $taskCallback = function ($result) use (&$results, &$pending, $numTasks, $i, $deferred) {

            $results[$i] = $result;



            if (count($results) === $numTasks) {

                $deferred->resolve($results);

            }

        };
<?php     };



    $next = function () use (&$tasks, $taskCallback, $deferred, &$results, &$pending) {

        if (0 === count($tasks)) {

            $deferred->resolve($results);

            return;

        }
<?php     $next = function ($value = null) use (&$tasks, &$next, $deferred, &$pending) {

        if (0 === count($tasks)) {

            $deferred->resolve($value);

            return;

        }