我听说 PHP 计划引入“goto”命令的传言。它应该做什么?
我尝试搜索了一下,但没有找到任何具有描述性的内容。我明白这不会是“GOTO 10
“——类似命令...
They are not adding a real GOTO, but extending the BREAK keyword to use static labels. Basically, it will be enhancing the ability to break out of switch nested if statements. Here's the concept example I found:
<?php
for ($i = 0; $i < 9; $i++) {
if (true) {
break blah;
}
echo "not shown";
blah:
echo "iteration $i\n";
}
?>
当然,GOTO“谣言”一经传出,就没有什么能阻止一些恶人再传播一则谣言了。COMEFROM玩笑。保持警惕。
也可以看看:
http://www.php.net/~derick/meeting-notes.html#adding-goto http://www.php.net/~derick/meeting-notes.html#adding-goto
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)