CKTIS / PHP
sprintf()
Build and return formatted text without printing it.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
sprintf(string $format, mixed ...$values): stringBuild and return formatted text without printing it. Numbered placeholders choose argument positions starting at one and can reorder values. Width is a minimum, not a truncation limit. Use %% for a literal percent and pass enough arguments for every referenced position.
Signature
sprintf(string $format, mixed ...$values): string
Example output
id/0007/%
Examples
<?php
echo sprintf('%2$s/%1$04d/%%',7,"id");
Result
id/0007/%