str_pad

Supported Versions: PHP 4 >= 4.0.1, PHP 5, PHP 7, PHP 8
Pad a string to a certain length with another string
<?php str_pad(    string $string,    int $length,    string $pad_string = " ",    int $pad_type = STR_PAD_RIGHT): string
<?php     {

        $expression = $this->formatCronExpression($event->expression, $expressionSpacing);



        $repeatExpression = str_pad($this->getRepeatExpression($event), $repeatExpressionSpacing);



        $command = $event->command ?? '';
<?php         $expressions = preg_split("/\s+/", $expression);



        return collect($spacing)

            ->map(fn ($length, $index) => str_pad($expressions[$index], $length))

            ->implode(' ');

    }
<?php                     $description = substr($description, 0, $remaining - 3) . '...';

                }



                $io->write(str_pad($result['name'], $nameLength, ' ') . $warning . $description);

            }

        } elseif ($format === 'json') {

            $io->write(JsonFile::encode($results));
<?php                 }



                foreach ($packages as $package) {

                    $io->write($indent . str_pad($package['name'], $nameLength, ' '), false);

                    if (isset($package['version']) && $writeVersion) {

                        $io->write(' ' . str_pad($package['version'], $versionLength, ' '), false);

                    }
<?php                 foreach ($packages as $package) {

                    $io->write($indent . str_pad($package['name'], $nameLength, ' '), false);

                    if (isset($package['version']) && $writeVersion) {

                        $io->write(' ' . str_pad($package['version'], $versionLength, ' '), false);

                    }

                    if (isset($package['latest']) && $writeLatest) {

                        $latestVersion = $package['latest'];
<?php                         if (!$io->isDecorated()) {

                            $latestVersion = str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('=', '!', '~'), $updateStatus) . ' ' . $latestVersion;

                        }

                        $io->write(' <' . $style . '>' . str_pad($latestVersion, $latestLength, ' ') . '</' . $style . '>', false);

                    }

                    if (isset($package['description']) && $writeDescription) {

                        $description = strtok($package['description'], "\r\n");
<?php         $str = "Pool:\n";



        foreach ($this->packages as $package) {

            $str .= '- '.str_pad((string) $package->id, 6, ' ', STR_PAD_LEFT).': '.$package->getName()."\n";

        }



        return $str;
<?php     {

        $string = "\n";

        foreach ($this->rules as $type => $rules) {

            $string .= str_pad(self::$types[$type], 8, ' ') . ": ";

            foreach ($rules as $rule) {

                $string .= ($repositorySet && $request && $pool ? $rule->getPrettyString($repositorySet, $request, $pool, $isVerbose) : $rule)."\n";

            }
<?php             $mask .= chr(0xff ^ (0xff >> $remainder));

        }



        $mask = str_pad($mask, $size, chr(0));



        return $this->ipMapTo6($mask, $size);

    }
<?php     private function padColumn(string $text, int $width)

    {

        $ansiCharacterPadding = strlen($text) - strlen($this->stripAnsi($text));

        return str_pad($text, $width + $ansiCharacterPadding);

    }



    private function stripAnsi(string $text): string
<?php function ansi(int $code)

{

    $code = str_pad($code, 3, 0, STR_PAD_LEFT);

    return "\x1b[{$code}m";

}
<?php     private static function formatSeconds(string $s, string $us): string

    {

        return sprintf('%02d.%s', $s, 0 === ($len = \strlen($t = rtrim($us, '0'))) ? '0' : ($len <= 3 ? str_pad($t, 3, '0') : $us));

    }

}
<?php         $this->output->write("\r");


        $this->output->write(str_pad(' ', $this->lineLength));


        $this->output->write("\r");

    }
<?php     protected function disableForeignKeyConstraints($stub): string

    {

        $stub = str_replace('Schema::create(', 'Schema::disableForeignKeyConstraints();' . PHP_EOL . PHP_EOL . str_pad(' ', 8) . 'Schema::create(', $stub);



        $stub = str_replace('});', '});' . PHP_EOL . PHP_EOL . str_pad(' ', 8) . 'Schema::enableForeignKeyConstraints();', $stub);
<?php     {

        $stub = str_replace('Schema::create(', 'Schema::disableForeignKeyConstraints();' . PHP_EOL . PHP_EOL . str_pad(' ', 8) . 'Schema::create(', $stub);



        $stub = str_replace('});', '});' . PHP_EOL . PHP_EOL . str_pad(' ', 8) . 'Schema::enableForeignKeyConstraints();', $stub);



        return $stub;

    }