PHP fprint() Function

PHP fprint() function is used to write a formatted string to a stream. In another words we can say that this function format string to a specified output stream( file or database).

Syntax:

ParameterDescriptionRequired/Optional
streamSpecify string where to write /output the stringRequired
FormatSpecify the string.Required
arg1Specify the argument to be inserted at first.required
arg2Specify the argument to be inserted at second.Optional
arg++Specify the argument to be inserted at third, fourth etc.Optional

Example 1

Output:

43

Example 2

Output:

%b = 111010110111100110100010101 
%c = 2 
%d = 123456789 
%d = -123456789 
%e = 1.234568e+8 
%E = 1.234568E+8 

Example 3

Output:

%u = 123456789 
%u = 4171510507 
%f = 123456789.000000 
%F = 123456789.000000 
%g = 1.23457e+8 
%G = 1.23457E+8 
%o = 726746425 

Example 4

Output:

%s = 123456789 
%x = 75bcd15 
%X = 75BCD15 
%+d = +123456789 
%+d = -123456789 

Next TopicPHP String




Latest Courses