I have a folder in which there are 12 files, in php i am send two request parameters are:
$from = $_REQUEST['from'];
$to = $_REQUEST['to'];
means if i write there from 1 to 9, then i’ll get all files which is in array as:
$path = 'example/'
$files = scandir($path);
$fi = array();
foreach ($files as $file) {
$fi[] = $file; --> array
}
all file ranges which i am specified using request parameters are display files using through echo or explode, i am trying this, if there is more efficient way then please enlighten on this problem.
You can use array_slice:
If
$_REQUEST[from]and[to]are 1-indexed, simply substract 1 from both: