PHP sprintf Function
What is sprintf Function and how it is used in string?
This function is used to return a formatted string in PHP.
In the above syntax "format" specifies the format of the string to be output,in which user can include the following formatting characters " %% ,%b , %c, %d, %e, %u, %f, %F, %o, %s, %x, %X ", "arg1" is the argument inserted in the first % sign, "arg2" in the second % sign, "arg++" is an optional argument that can be inserted in third and fourth % signs.
$str = "HIOX INDIA";
$number = 365;
$val= sprintf("%s can host websites %u days",$str,$number);
HIOX INDIA can host websites 365 days
In the above example the strings are formatted and stored in a variable "$val".