Re: While-else

From: Date: Sat, 28 Apr 2007 18:10:41 +0000
Subject: Re: While-else
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-29093@lists.php.net to get a copy of this message
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Pelle Ravn Rosfeldt wrote: > Hi there. > > Is it possible to make a "while" with a "else"-statement in PHP6? > I know that it's not the first time this subject is up, but my research > shows that a lot of people miss it. Including me. There's already a bug for it: http://bugs.php.net/bug.php?id=26411 > Here's an example of what I mean: > --------------------- > <? > $i = 1; > while ($i <= 10) { > echo $i++; > } else { > echo "The while couldn't be executed!"; > } > ?> > --------------------- Your example never enters the else part of the statement. A better example would be using $i = 11 or higher value. - -- Best regards Asbjørn Sloth Tønnesen -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFGM44gSViWlxucwuoRAlIrAJ9Xi5y7MkJCkNfW9lqtQ255D5uOWACeKNmU bNnKnuzxJhozYwchyZlOVzw= =CD+b -----END PGP SIGNATURE-----

« previous php.internals (#29093) next »