<?PHP
  // 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")
        );
      }
    }
    $d->close();

    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.

Recommended Answers

All 2 Replies

// 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

Member Avatar for diafol

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.