note 30273 modified in function.call-user-func-array by vrana

From: Date: Tue, 17 Aug 2004 14:53:55 +0000
Subject: note 30273 modified in function.call-user-func-array by vrana
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-79878@lists.php.net to get a copy of this message
This function, combined with some others, can allow you to make some really easy & generic function macros (since real macros don't exist in PHP yet). <?php function my_printf() { $args = func_get_args(); return call_user_func_array('printf', $args); } ?> This allows you to use my_printf() just as if it were printf() itself. Very useful since you don't have to worry about how many arguments any functions take. --was-- This function, combined with some others, can allow you to make some really easy & generic function macros (since real macros don't exist in PHP yet). function my_printf() { $args = func_get_args(); return call_user_func_array('printf', $args); } This allows you to use my_printf() just as if it were printf() itself. Very useful since you don't have to worry about how many arguments any functions take. http://php.net/manual/en/function.call-user-func-array.php

« previous php.notes (#79878) next »