note 37697 added to function.fprintf

From: Date: Sun, 23 Nov 2003 10:50:00 +0000
Subject: note 37697 added to function.fprintf
Groups: php.notes 
Request: Send a blank email to php-notes+get-60872@lists.php.net to get a copy of this message
For you pre-5.0 fans: if (!function_exists('fprintf')) { if (function_exists('vsprintf')) { // >= 4.1.0 function fprintf() { $args = func_get_args(); $fp = array_shift($args); $format = array_shift($args); return fwrite($fp, vsprintf($format, $args)); } } else { // < 4.1.0 function fprintf() { $args = func_get_args(); $fp = array_shift($args); $format = array_shift($args); $code = ''; for ($i = 0; $i < count($args); ++$i) { if ($code) { $code .= ','; } $code .= '$args[' . $i . ']'; } $code = 'return sprintf($format, ' . $code . ');'; $rv = eval($code); return $rv ? fwrite($fp, $rv) : false; } } } ---- Manual Page -- http://www.php.net/manual/en/function.fprintf.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+37697 Delete -- http://master.php.net/manage/user-notes.php?action=delete+37697&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+37697&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#60872) next »