Page 1 of 1
continue break removed from php
Posted: Mon Aug 08, 2011 5:26 am
by yacahuma
Hello, I just check and they remove break continue from php in the latest version. Can someone please tell me what whas wrong with that and what are we supposed to use now for the same thing?
Thank you
Re: continue break removed from php
Posted: Mon Aug 08, 2011 6:01 am
by Weirdan
What's your source?
Re: continue break removed from php
Posted: Mon Aug 08, 2011 6:30 am
by yacahuma
Re: continue break removed from php
Posted: Mon Aug 08, 2011 9:51 am
by greyhoundcode
tinsology.net wrote:Code: Select all
for($i = 0; $i < 3; $i++)
{
for($j = 0; $j < 3; $j++)
{
if($i == 1)
break 2;
echo "$i:$j\n";
}
}
The above will output:
0:0
0:1
0:2
Do you know I wasn't even aware you could do that with
break.
Re: continue break removed from php
Posted: Mon Aug 08, 2011 10:47 am
by AbraCadaver
break/continue
$var - so this is what I believe they removed:
Code: Select all
$var = 2;
for($i = 0; $i < 3; $i++)
{
for($j = 0; $j < 3; $j++)
{
if($i == 1)
break $var;
echo "$i:$j\n";
}
}
And also:
Re: continue break removed from php
Posted: Mon Aug 08, 2011 12:49 pm
by yacahuma
Ok, I thought they removed the whole continue break. I personally dont use break $var. So at least for me is ok, IF that is what it is
Re: continue break removed from php
Posted: Mon Aug 08, 2011 12:54 pm
by AbraCadaver
yacahuma wrote:Ok, I thought they removed the whole continue break. I personally dont use break $var. So at least for me is ok, IF that is what it is
I don't use it either and have never seen it in any code. Thank God. That would be horrible to maintain/debug.
Re: continue break removed from php
Posted: Tue Aug 09, 2011 2:10 am
by VladSun
AbraCadaver wrote:I don't use it either and have never seen it in any code. Thank God. That would be horrible to maintain/debug.
break/coontinue are not so bad, IMHO - they are both "near jumps" just like
IF-ELSE and they behave like a "local-scope-void-return" statement. Can't say the same for goto(), though
PS: I missed the "
$var" note in the discussion. And yes - I agree break/continue
$var is not good

Re: continue break removed from php
Posted: Tue Aug 09, 2011 9:33 am
by greyhoundcode
VladSun wrote:Can't say the same for goto(), though

Nice cartoon on the
PHP Manual's Goto() page!