Re: Speaking of Global Annoyance

From: Date: Mon, 18 Dec 2000 23:47:00 +0000
Subject: Re: Speaking of Global Annoyance
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-30960@lists.php.net to get a copy of this message
You have to global in your function, nor do you have a return value for your function. Jeremy Brand :: Sr. Software Engineer :: 408-245-9058 :: jeremy@nirvani.net http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html for more Get your own Free, Private email at http://www.smackdown.com/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - At least for the people who send me mail about a new language that they're designing, the general advice is: do it to learn about how to write a compiler. --Dennis Ritchie On Mon, 18 Dec 2000, Kevin Leavell wrote: > Date: Mon, 18 Dec 2000 16:39:25 -0700 > From: Kevin Leavell <k@bigsky.net> > To: php-general@lists.php.net > Subject: [PHP] Speaking of Global Annoyance > > I want to return the array of image names ($imagename) from a directory so > the script doesn't have to read the directory constantly. I have tried > global and return and $GLOBAL but $imagename comes back empty. > > It works just fine until I try to implement the function. > > function getimages() > { > chdir("images"); //read image names from directory /images > $dir = dir("."); > $dir->rewind(); > while ($file=$dir->read()) > { > if(!is_dir("$file")) //if the variable isn't a directory then put it in the > array imagename > { > $imagename[$file] = $file; //adds the filename to the array imagename > } > } > } > > Image viewing code here > > Thanks > > Kevin Leavell > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#30960) next »