I have a folder that has a bunch of images. Then I have a script to view the images of that folder, it puts the images one by one on top of each other along with details about the image. I'd like to put the images into tables and have 2 or 3 images per row. I'm not sure how to do that?

PHP Code:
$search $num;  //$num is the search for image with a specific number
$dir "savedImage/";
$files scandir($dir);
foreach(
$files as $$key=>$value){if(stripos($value$search) !== false){                 $array_of_images[] = $value;
}
}
 {       
  foreach(
$array_of_images as $value)     
            {   echo 
"<a href='savedImage/".$value."' target='blank'>"$value ."'<br><img src=./savedImage/" $value " width=300></a><br><br>";         
        }