note 11369 added to continue

From: Date: Sun, 18 Feb 2001 06:49:45 +0000
Subject: note 11369 added to continue
Groups: php.notes 
Request: Send a blank email to php-notes+get-11205@lists.php.net to get a copy of this message
The previous post is incorrect; "if" statement blocks are not counted as loop constructs with regards to "continue" statements. Given the following PHP code: <? $getOut = 0; while (1) { echo "Beginning of first loop\n"; while (1) { echo "Beginning of second loop\n"; if (++$getOut <= 2) { echo "Beginning of if statement\n"; continue $getOut; } echo "Breaking out of second loop\n"; break; } echo "Breaking out of first loop\n"; break; } ?> the corresponding output will be: Beginning of first loop Beginning of second loop Beginning of if statement Beginning of second loop Beginning of if statement Beginning of first loop Beginning of second loop Breaking out of second loop Breaking out of first loop -Devin http://www.php.net/manual/en/control-structures.continue.php

« previous php.notes (#11205) next »