is it possible to start a foreach loop from specific element [sixth element]?
im using this code:
<?php
$num=1;
foreach($temp_row as $key => $value) {
echo $num;
$num++;
}
?>
thanks :)
Keep it simple. foreach ($arr as $k => $v) { if ($k < 1) continue; // your code here. }
Introduction. The continue statement is one of the looping control keywords in PHP. When program flow comes across continue inside a loop, rest of the statements in current iteration of loop are skipped and next iteration of loop starts. It can appear inside while, do while, for as well as foreach loop.
You can use for example array_slice()
$num = 5; //it will start from sixth element
foreach(array_slice($temp_row, $num) as $key => $value) {
echo $key.'=>'.$value.'<br>';
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With