note 55131 deleted from function.func-get-args by bjori

From: Date: Tue, 25 Apr 2006 19:07:04 +0000
Subject: note 55131 deleted from function.func-get-args by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-109669@lists.php.net to get a copy of this message
Note Submitter: jwhite at ytztech dot com ---- It doesn't appear in the notes for func_get_args(), but this function will return FALSE when no arguments have been passed. Therefore, you can use a function like this: function test() { echo '<h1>Did this work?</h1>'; if ($array = func_get_args()) { echo '<h1>SUCCESS!</h1>'; } } // Prints <h1>SUCCESS!</h1> test(1,2,3,4); // Doesn't print <h1>SUCCESS!</h1> test(); Testing for the arguments becomes a matter of pulling them. Unless one really have a need for func_num_args(), testing for FALSE should suffice most of us.

« previous php.notes (#109669) next »