note 77356 deleted from function.func-get-args by bjori
| From: | bjori@php.net | Date: | Sun, 26 Aug 2007 08:30:12 +0000 |
| Subject: | note 77356 deleted from function.func-get-args by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-129800@lists.php.net to get a copy of this message | ||
Note Submitter: Anacreo at gmail dot com
Reason: in docs
----
I've found this as a useful construct for my variable length functions...
<?
class logger {
function __construct() {
$args = func_get_args();
$args = array (
'filename' => $args[0], // filename to store log in
'writefile' => isset($args[1]) ? $args[1] : true, // write file or not,
default true
'storelog' => isset($args[2]) ? $args[2] : true, // store log internally,
default true
);
print_r($args);
}
?>
When run will produce the following:
$log = new logger("/tmp/logger." . getmypid(),false);
Array
(
[filename] => /tmp/logger.9423
[writefile] =>
[storelog] => 1
)
$log = new logger();
Array
(
[filename] =>
[writefile] => 1
[storelog] => 1
)