Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the valid use cases of goto in PHP? [closed]

Tags:

php

goto

I know, there are 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.

like image 888
NikiC Avatar asked Jan 30 '11 15:01

NikiC


1 Answers

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

like image 185
Mchl Avatar answered Sep 27 '22 17:09

Mchl