// Original PHP code by Chirp Internet: [url]www.chirp.com.au[/url]
  // Please acknowledge use of this code by including this header.

  function getImages($dir)
    global $imagetypes;

    // array to hold return value What does retval mean?
    $retval = array();

    // add trailing slash if missing
    if(substr($dir, -1) != "/") $dir .= "/";

    // full server path to directory
    $fulldir = "{$_SERVER['DOCUMENT_ROOT']}/$dir";
  // $d ? what does this mean?
  // @dir  also?
 //$entry ?
    $d = @dir($fulldir) or die("getImages: Failed opening directory $dir for reading");
    while(false !== ($entry = $d->read())) {
      // skip hidden files
      if($entry[0] == ".") continue;

      // check for image files
      if(in_array(mime_content_type("$fulldir$entry"), $imagetypes)) {
        $retval[] = array(
         "file" => "/$dir$entry",
         "size" => getimagesize("$fulldir$entry")

    return $retval;

I am begining to understand php , but i am unsure just what words,phrases the language understands

for eg. above mime_content_type can you give me some guides please aswell

thanks for reading.

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

7 Years
Discussion Span
Last Post by diafol
// array to hold return value What does retval mean?
$retval = array();

From this question it seems what you are asking is for people to teach you PHP, rather than a specific question to a problem. There are many good PHP tutorials around on the net that will help you do this. Just Google.

In specific answer to the quoted question above, $retval is a variable, more specifically, an array, see: http://uk3.php.net/manual/en/book.array.php


zeus: although this is a php help forum, it's not really for explaining basic words and phrases. As BD says, get hold of some tutorials and download the php manual from php.net. You need to do your own research.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.