Is there a way to define global label (something like variables) for PHP goto
, in order to use it inside function declaration. I want to do the following:
function myFunction() {
if (condition) {
goto someLine;
}
}
someLine:
// ....
myFunction();
when I use this code it says
PHP Fatal error: 'goto' to undefined label "someLine"
I know that it is not recommended to use goto
statement. But I need it in my case. I know that perhaps always there are alternatives of goto
, just in my case it would make the code a little easier and understandable