string sprintf ( string $string_pattern, [, mixed $placeholder_value [, mixed $... ]] );
This PHP function replaces the placeholders in a string with the specified values and returns the formatted string. The placeholders begin with a percent sign (%) and are allowed by the format, e.g. s (for string), d (for integer), and f (for floating point). The function replaces out each placeholder with its associated value, as specified by:
- The specific order identified in the placeholder syntax, e.g.
%2$ssays give me the second
- Matching the placeholder order with the order of the values.
- The string pattern which holds the placeholders to be populated when running this function.
- optional The first placeholder value.
- optional Additional placeholder values, comma-separated.
Returns formatted string.
You get WET when you swim. Stay DRY when you code.
More coming soon…keep checking back.