parameter list and their problems
Posted: Fri Jul 26, 2002 8:39 am
i wanted to write an alias for the printf function which automaticly puts a br and a newline on the end of the line.
either it has to work like this:
<code>
function my_printf () {
printf (
do_something_important(func_get_args())
);
echo "<br>\n";
}
// so the line:
my_printf ("Hello World. Today it's the %d.!", (int)date("d"));
// will have the output line:
// Hello World. Today it's the 25.!<br>\n
</code>
but i have no idea how to convert the argument-array to use it again as parameter-list for the printf function.
so the do_something_important function has to split the array in the single arguments and put it in the right format ...
i know that this would work in C because i've tried it. but i wonder how it works in php
or it hast to work with a kind of makro ... i look forward to any kind of solution
second question:
is there any algorythm to calculate the week number out of a date?
thanks and sorry for my bad english =)
bye
either it has to work like this:
<code>
function my_printf () {
printf (
do_something_important(func_get_args())
);
echo "<br>\n";
}
// so the line:
my_printf ("Hello World. Today it's the %d.!", (int)date("d"));
// will have the output line:
// Hello World. Today it's the 25.!<br>\n
</code>
but i have no idea how to convert the argument-array to use it again as parameter-list for the printf function.
so the do_something_important function has to split the array in the single arguments and put it in the right format ...
i know that this would work in C because i've tried it. but i wonder how it works in php
or it hast to work with a kind of makro ... i look forward to any kind of solution
second question:
is there any algorythm to calculate the week number out of a date?
thanks and sorry for my bad english =)
bye