sajad torkamani
$a = [2, 4, 6, 8, 10, 12, 14];

print_r(array_slice($a, 2, 1));
// [6]

print_r(array_slice($a, 2, 2));
// [6, 8]

print_r(array_slice($a, 2, 3));
// [6, 8, 10]

print_r(array_slice($a, 2));
// [6, 8, 10, 12, 14]

Sources

Tagged: PHP

Leave a comment

Your email address will not be published. Required fields are marked *