round

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Rounds a float
<?php round(int|float $num, int $precision = 0, int $mode = PHP_ROUND_HALF_UP): float
<?php     public function progress()

    {

        return $this->totalJobs > 0 ? round(($this->processedJobs() / $this->totalJobs) * 100) : 0;

    }
<?php             return null;

        }



        return round(

            $this->filter($callback)->count() / $this->count() * 100,

            $precision

        );

    }
<?php                 $this->dispatcher->dispatch(new ScheduledTaskFinished(

                    $event,

                    round(microtime(true) - $start, 2)

                ));



                $this->eventsRan = true;
<?php     protected function getElapsedTime($start)

    {

        return round((microtime(true) - $start) * 1000, 2);

    }
<?php         $result = $this->client->{$method}(...$parameters);



        $time = round((microtime(true) - $start) * 1000, 2);



        if (isset($this->events)) {

            $this->event(new CommandExecuted(
<?php         $value = floatval($size);



        return round(match (true) {

            Str::endsWith($size, 'kb') => $value * 1,

            Str::endsWith($size, 'mb') => $value * 1000,

            Str::endsWith($size, 'gb') => $value * 1000000,

            Str::endsWith($size, 'tb') => $value * 1000000000,

            default => throw new InvalidArgumentException('Invalid file size suffix.'),

        });

    }
<?php         Sleep::for(1.5)->seconds();

        $end = microtime(true);



        $this->assertEqualsWithDelta(1.5, round($end - $start, 1, PHP_ROUND_HALF_DOWN), 0.03);

    }



    public function testItCanFakeSleeping()
<?php         if ($this->enabled) {

            $this->output->writeln(sprintf(

                '  <fg=gray>Memory:</>   <fg=default>%s MB</>',

                round(memory_get_usage(true) / 1000 ** 2, 3)

            ));

        }
<?php         $terminalWidth = $this->getTerminalWidth();



        $url = parse_url($request['url'], PHP_URL_PATH) ?: '/';

        $duration = number_format(round($request['duration'], 2), 2, '.', '');



        $memory = isset($request['memory'])

            ? (number_format($request['memory'] / 1024 / 1204, 2, '.', '').' mb ')
<?php     public function getArray()

    {

        return [$this->r, $this->g, $this->b, round(1 - $this->a / 127, 2)];

    }
<?php     public function getRgba()

    {

        return sprintf('rgba(%d, %d, %d, %.2F)', $this->r, $this->g, $this->b, round(1 - $this->a / 127, 2));

    }
<?php     public function differs(AbstractColor $color, $tolerance = 0)

    {

        $color_tolerance = round($tolerance * 2.55);

        $alpha_tolerance = round($tolerance * 1.27);



        $delta = [
<?php     public function differs(AbstractColor $color, $tolerance = 0)

    {

        $color_tolerance = round($tolerance * 2.55);

        $alpha_tolerance = round($tolerance * 1.27);



        $delta = [

            'r' => abs($color->r - $this->r),
<?php         $blue = $this->argument(2)->between(-100, 100)->required()->value();




        $red = round($red * 2.55);

        $green = round($green * 2.55);

        $blue = round($blue * 2.55);
<?php         $red = round($red * 2.55);

        $green = round($green * 2.55);

        $blue = round($blue * 2.55);