• PHP Video Tutorials

PHP - Function fprintf



Syntax

int fprintf ( resource $handle , string $format [, mixed $args [, mixed $... ]] )

Definition and Usage

It is used to write a formatted string to a stream

Return Values

It returns the length of the string written

Parameters

Sr.No Parameters & Description
1

stream

The stream specifies the where to write

2

format

The specifies the string and contained information about how to format the string

Example

Try out the following example

<?php
   $input = 123;
   $file = fopen("sample.txt","r");
   
   fprintf($file,"%f",$input);
?>

This will produce following result − −

123.000000
php_function_reference.htm
Advertisements