continue break removed from php
Moderator: General Moderators
continue break removed from php
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
Thank you
Re: continue break removed from php
What's your source?
- greyhoundcode
- Forum Regular
- Posts: 613
- Joined: Mon Feb 11, 2008 4:22 am
Re: continue break removed from php
Do you know I wasn't even aware you could do that with break.tinsology.net wrote:The above will output:Code: Select all
for($i = 0; $i < 3; $i++) { for($j = 0; $j < 3; $j++) { if($i == 1) break 2; echo "$i:$j\n"; } }
0:0
0:1
0:2
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: continue break removed from php
break/continue $var - so this is what I believe they removed:yacahuma wrote:http://www.php.net/archive/2011.php#id2011-06-28-1
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";
}
}Code: Select all
continue $var;mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Re: continue break removed from php
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
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: continue break removed from php
I don't use it either and have never seen it in any code. Thank God. That would be horrible to maintain/debug.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
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Re: continue break removed from php
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(), thoughAbraCadaver wrote:I don't use it either and have never seen it in any code. Thank God. That would be horrible to maintain/debug.
PS: I missed the "$var" note in the discussion. And yes - I agree break/continue $var is not good
There are 10 types of people in this world, those who understand binary and those who don't
- greyhoundcode
- Forum Regular
- Posts: 613
- Joined: Mon Feb 11, 2008 4:22 am
Re: continue break removed from php
Nice cartoon on the PHP Manual's Goto() page!VladSun wrote:Can't say the same for goto(), though