note 88221 added to function.func-get-args
| From: | Andrey at osu1 dot php dot net | Date: | Fri, 16 Jan 2009 01:07:06 +0000 |
| Subject: | note 88221 added to function.func-get-args | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-149301@lists.php.net to get a copy of this message | ||
Instead of
<?php
put2log(sprintf('Error %u occured, try use %s.', 123, 'your head'));
?>
You can use this
<?php
function put2log($msg /*, ...*/)
{
$args = func_get_args();
$msg = eval('return sprintf($args['. implode('], $args[', array_keys($args))
.']);');
write_to_my_log($msg);
}
?>
And now you can call
<?php
put2log('Error %u occured, try use %s.', 123, 'your head');
?>
----
Server IP: 195.54.192.44
Probable Submitter: 127.0.0.1
----
Manual Page -- http://www.php.net/manual/en/function.func-get-args.php
Edit -- https://master.php.net/note/edit/88221
Del: integrated -- https://master.php.net/note/delete/88221/integrated
Del: useless -- https://master.php.net/note/delete/88221/useless
Del: bad code -- https://master.php.net/note/delete/88221/bad+code
Del: spam -- https://master.php.net/note/delete/88221/spam
Del: non-english -- https://master.php.net/note/delete/88221/non-english
Del: in docs -- https://master.php.net/note/delete/88221/in+docs
Del: other reasons-- https://master.php.net/note/delete/88221
Reject -- https://master.php.net/note/reject/88221
Search -- https://master.php.net/manage/user-notes.php