PHP vsprintf Function
What is vsprintf Function?
Explanation
This function is used to return a formatted string.
Syntax:
vsprintf(format,argarray)
In the above PHP syntax "format" specifes the formatting string to be used "%%", "%b", "%c", "%d", "%e", "%u", "%f", "%F", "%o", "%s", "%x", "%X", "argarray" specifies an array with arguments to be inserted at % sign.
Example :
<?php
$str = "Hi";
$number = 6117;
$ret = vsprintf("%s my employee number is %u",array($str,$number));
echo $ret;
?>
Result :
Hi my employee number is 6117
In the above vsprintf function example the output is returned to a variable "$ret".