Hi all, I need a help, if I have a multiple values in a array, how can I skip a value ? E.g $dp = array('first','secode','third','fourth','fifth,'sixth'); foreach($dp as $php) { echo $php; if($php = 'third') skip and next; } PHP:
Uhm, from your code you want to skip the fourth one, right? If so, put what you do in a IF statement with a NOT. foreach ($dp as $php) { if ($php != 'fourth') echo $php; } Code (markup): Will echo 'firstsecodethirdfifthsixth' Another approach would be to run your if statement BEFORE you do anything, and use "continue". foreach ($dp as $php) { if ($php == 'fourth') continue; echo $php; } Code (markup): The trick being to 'continue' BEFORE the operation that outputs, instead of after. Though you might want to check your string (you missed a single quote), and you used assignment (=) instead of compare (==)