note 114585 deleted from function.func-get-args by peehaa

From: Date: Mon, 08 Apr 2019 06:11:14 +0000
Subject: note 114585 deleted from function.func-get-args by peehaa
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-210546@lists.php.net to get a copy of this message
Note Submitter: dev at mp3addict dot pw ---- This function is as printf() but only calls printf() when the debug_enabled global variable is set to TRUE. Because by this way, you can use debug() instead of echo | printf() and set debug_enabled to false after checking and submitting work into production. cheers; function debug () { if ($GLOBALS['debug_enabled'] == true) { $args = func_get_args(); $fmt = $args[0]; $printf_args = ''; for ($i = 1; $i < count($args); $i++) { $printf_args .= ",\"{$args[$i]}\""; } eval("printf(\"{$fmt}\"{$printf_args});"); } }

« previous php.notes (#210546) next »