PHP中goto的有效用例是什么? [英] What are the valid use cases of goto in PHP?

查看:80
本文介绍了PHP中goto的有效用例是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道,还有其他

因此,问题是:"PHP中goto的有效用例是什么?".回答"goto是邪恶的吗?"不受欢迎,并且会被否决.谢谢:)

或者有人链接到RFC,其中解释了该决定-我找不到.

解决方案

一种可能的用法(但是可以使用其他方式实现)是实现other questions about the goto statement introduced in PHP 5.3.

But I couldn't find any decent answer in there, all were of the type "last resort", "xkcd", "evil", "bad", "EVIL!!!". But no valid example. Only statements that there aren't any uses. Or statements that there are some rare use cases (again, without examples).

So, the question is: "What are the valid use cases of goto in PHP?". Answers for "Is goto evil?" are not welcome and will get downvoted. Thanks :)

Or does somebody have a link to an RFC where the decision is explained - I couldn't find one.

解决方案

One possible use (that can however be be implemented using other means) is implementation of a finite state machine.

这篇关于PHP中goto的有效用例是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆