I\'m trying to figure out if its possible to stop a foreach loop in PHP, like this,
$arr = array(\'Joe\', \'Jude\', \'James\', \'Pitch\', \'Tim\'); $i=0; foreach
You can use good old keyword break here as well. Followed by a semicolon ; of course.
break
;
if($i == 2){ break; }
Manual for break