How would I go about doing this in PHP 3 not PHP 4??
There really aren't very many version incompatibilities between PHP3 and
PHP4. This will work in either case.
Since you can't predict how many images will be in the directory, or what
their names will be, building the array in one step won't work unless you
wanted to build up a delimited string and implode() it afterwards, which
is just extra work. Fortunately, you can append to an array in a loop,
which makes the task you want to accomplish quite simple.