Hi guys, I've an array I want to split in two parts. I've tried this and it isn't working. foreach($array as $key => $value) { echo $key. " => " . $value . "<br/>"; if ($key == 4) { echo "Loop is paused.<br/>"; break; } if ($key > 4) { # This won't work. echo "Loop is continued.<br/>"; continue; } } Code (markup): Any ideas how to get it work?
Of course that won't work. If you explain what you're trying to do, exactly, maybe we could offer a solution.
OK, Here's the result I want: 0 => 0 1 => 1 2 => 2 3 => 3 4 => 4 Loop is paused. Loop continues... 5 => 5 6 => 6 7 => 7 8 => 8 .... Thank you,
Well, I'm an idiot. This works: foreach($array as $key => $value) { echo $key. " => " . $value . "<br/>"; if ($key == 4) { printf( "Loop breaks. <br/>"); } } Code (markup):