Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Return a formatted string
<?php sprintf(string $format, mixed ...$values): string
<?php         $defaultUrl = route($route, $token);



        $url = static::$url

            ? sprintf('%s?token=%s', static::$url, $token)

            : $defaultUrl;



        parse_str(parse_url($url, PHP_URL_QUERY) ?: '', $query);
<?php     public function handle()

    {

        $this->line(sprintf('<info>Statamic</info> %s %s', Statamic::version(), Statamic::pro() ? 'Pro' : 'Solo'));

        $this->line('<info>Laravel</info> '.Application::VERSION);

        $this->line('<info>PHP</info> '.phpversion());

        $this->addons();
<?php         }



        foreach ($addons as $addon) {

            $this->line(sprintf('<info>%s</info> %s', $addon->package(), $addon->version()));

        }

    }

}
<?php     public function __call($method, $args)

    {

        if (! property_exists($this, $method)) {

            throw new \Exception(sprintf('Call to undefined method %s::%s', get_class($this), $method));

        }



        if (empty($args)) {
<?php     {

        $html = $request->ajax() || $request->wantsJson()

            ? __('Service Unavailable')

            : sprintf('<meta http-equiv="refresh" content="1; URL=\'%s\'" />', $request->getUri());



        return response($html, 503, ['Retry-After' => 1]);

    }
<?php     protected function generatePath()

    {

        if (is_string($this->item) && Str::isUrl($this->item)) {

            $method = sprintf('generateBy%s', Str::startsWith($this->item, 'http') ? 'Url' : 'Path');



            return $this->generator->$method($this->item, $this->params);

        }
<?php         if (! $asset) {

            throw new AssetNotFoundException(

                sprintf('Could not generate a static manipulated image URL from asset [%s]', $this->item)

            );

        }
<?php         if (Str::contains($tag, '.')) {

            [$tag, $classes] = explode('.', $tag, 2);

            $attributes = sprintf(' class="%s"', str_replace('.', ' ', $classes));

        }



        return "<{$tag}{$attributes}>$value</$tag>";
<?php     public function getIterator()

    {

        if (! is_array($this->value)) {

            throw new ModifierException(sprintf(

                'Attempted to access modified value as an array, but encountered [%s]',

                is_string($this->value) ? 'string' : get_class($this->value)

            ));

        }



        return new ArrayIterator($this->fetch());
<?php     public function path()

    {

        return sprintf('%s/%s.json', $this->config['path'], $this->name);

    }



    public function delete($document)
<?php             File::get(statamic_path("resources/svg/{$name}.svg"))

        );



        return str_replace('<svg', sprintf('<svg%s', $attrs), $svg);

    }



    public static function vendorAssetUrl($url = '/')
<?php                     ? ($value ? 'true' : 'false')

                    : $value;



                return sprintf('%s="%s"', $attribute, $value);

            })

            ->filter()

            ->implode(' ');
<?php     {

        return collect($meta)

            ->map(function ($value, $key) {

                return sprintf('<input type="hidden" name="_%s" value="%s" />', $key, $value);

            })

            ->implode("\n");

    }
<?php         $matches = collect($matches)->map(function ($match) {

            return [

                $match[0],

                sprintf('<img src="%s"', $this->generateGlideUrl($match[1])),

            ];

        })->transpose();
<?php         $blueprint->save();



        $this->console->line(sprintf(

            'Unique slug validation added to the <comment>%s</comment> collection\'s <info>%s</info> blueprint.',

            $collection->handle(),

            $blueprint->handle()

        ));

    }

}