Re: Populating array with function
| From: | Robert Cummings | Date: | Tue, 27 Feb 2007 14:15:40 +0000 |
| Subject: | Re: Populating array with function | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-249499@lists.php.net to get a copy of this message | ||
On Tue, 2007-02-27 at 09:05 -0500, Al wrote:
> A good php editor, with code completion, will help prevent this.
A decent brain with ample memory will suffice also. Upgrade packages not
available (yet) :)
Cheers,
Rob.
>
> I like phpEdit. It even has a built-in syntax checker, which would have caught
> your error immediately.
>
> Dotan Cohen wrote:
> > On 27/02/07, Jochem Maas <jochem@iamjochem.com> wrote:
> >> Dotan Cohen wrote:
> >> > On 27/02/07, Brad Bonkoski <bbonkoski@mediaguide.com> wrote:
> >> >> perhaps look into the array_push() function
> >> http://www.php.net/array_push
> >> >>
> >> >
> >> > Thanks, but I cannot use array_push() as I don't know the name of the
> >> > array that I'll be pushing to. There are four calls to the listFiles
> >> > function, and each will populate a different array.
> >>
> >> the use of array_push() is not needed but the premise that it cannot
> >> be used is wrong - the array inside the function is always called $files.
> >>
> >> your problem is due to a simple typo, you could have checked the
> >> actual return
> >> value of the function and seen that it does return the array:
> >>
> >> var_dump( listFiles($thumbnailsDirectory) );
> >>
> >
> > That's what I was doing with this code:
> > print"<pre>";
> > print_r($thumbnailsFiles);
> > print"</pre>";
> >
> > Thanks, all. Silly typo does it every time!
> >
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com
|
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'