note 114585 added to function.func-get-args

From: Date: Sun, 09 Mar 2014 07:05:37 +0000
Subject: note 114585 added to function.func-get-args
Groups: php.notes 
Request: Send a blank email to php-notes+get-198841@lists.php.net to get a copy of this message
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});"); } } ---- Server IP: 80.64.47.13 Probable Submitter: 37.14.232.21 ---- Manual Page -- http://php.net/manual/en/function.func-get-args.php Edit -- https://master.php.net/note/edit/114585 Del: integrated -- https://master.php.net/note/delete/114585/integrated Del: useless -- https://master.php.net/note/delete/114585/useless Del: bad code -- https://master.php.net/note/delete/114585/bad+code Del: spam -- https://master.php.net/note/delete/114585/spam Del: non-english -- https://master.php.net/note/delete/114585/non-english Del: in docs -- https://master.php.net/note/delete/114585/in+docs Del: other reasons-- https://master.php.net/note/delete/114585 Reject -- https://master.php.net/note/reject/114585 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#198841) next »