Use placeholders in fprintf in PHP

Description

The following code shows how to use placeholders in fprintf.

Example


  //ww w .j  av  a2  s .co m
<?php
    $number = 123.24;
    $file = fopen("test.txt","w");
    fprintf($file,"With 2 decimals: %1\$.2f\nWith no decimals: %1\$u",$number);
?>




















Home »
  PHP Tutorial »
    File »




Directory
DirectoryIterator
Drive
File
File Permission
File Read Save
FileSystemIterator
Path
Zip