0
<?php
$folder = array();
foreach (glob("/*/*.mp4") as $filename) {
    $folder[] = $filename;
}

for ($i = 0; $i < 10; ++$i) {
  echo '
    <div id="videoContainer">
    <video width="320" height="240" controls>
      <source src="'. $folder[$i] .'" type="video/mp4">
    </video>
  </div>
  ';
}
?>

This code gets all paths in subfolders with the type of mp4 file. At the end im going to count from 1-10 and echo out the path in the src part. Is there any better way to this without a database?

I would like to know how I can divide certain arrays by pages? As an example I would like to have only array 1-10 on page 1, 11-20 on page two etc. Any help would be appreciated.

mKeey
  • 133
  • 1
  • 13
  • there is https://php.net/array_chunk and perhaps better for display purposes ArrayIterator and LimitIterator, see [How to Paginate lines in a foreach loop with PHP](https://stackoverflow.com/q/1679559/367456) – hakre Jul 30 '23 at 20:40

0 Answers0