note 48287 deleted from function.glob by tularis

From: Date: Fri, 17 Dec 2004 22:29:29 +0000
Subject: note 48287 deleted from function.glob by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-81946@lists.php.net to get a copy of this message
Note Submitter: hpklett at hotmail dot com ---- I noticed that when I foreach (glob ( etc. I get a warning: "Invalid argument supplied for foreach()". This is obviously not fatal and the code will work, but for a testing server it's irritating having to sift through meaningless warnings (it's also irritating if you end up with warnings reported on a production server, ug). My quick and dirty solution: foreach (($result_set = glob ("????") ? $result_set : array ("empty_filename")) as $filename) { if ($filename = "empty_filename") echo "No four-letter file"; } Hope this helps someone that's as irritated as I was. ---- Reason: useless example

« previous php.notes (#81946) next »