converting this code in php function

Discussion in 'PHP' started by ironmankho, Sep 13, 2011.

  1. #1
    i am newbie in php i find this code want to convert in php function

    <?php
    //path to directory to scan
    $directory = "./list/";
     
    //get all image files with a .jpg extension.
    $images = glob($directory . "*.jpg");
     
    //print each file name
    foreach($images as $image)
    {
    echo $image.'<br/>';
    }
    ?>
    PHP:
     
    Solved! View solution.
    ironmankho, Sep 13, 2011 IP
  2. #2
    
    <?php
    function doSomething() {
        //path to directory to scan
        $directory = "./list/";//get all image files with a .jpg extension.
        $images = glob($directory . "*.jpg");
     
        //print each file name
        foreach($images as $image)
        {
            echo $image.'<br/>';
        }
    }
    ?>
    
    PHP:
     
    Rukbat, Sep 13, 2011 IP
  3. ironmankho

    ironmankho Active Member

    Messages:
    393
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #3
    Thanks for this :)
     
    ironmankho, Sep 13, 2011 IP