As you might know, GOTO operator will be officially available in PHP 5.3
There is already a page in PHP Documentation about GOTO operator http://php.net/goto
The goto operator can be used to jump to another section in the program. The target point is specified by a label followed by a colon, and the instruction is given as goto followed by the desired target label.
I was following the discussion around GOTO back in 2006 when Sara Golemon introduce it in PHP6 branches; and personally I think that GOTO will provide solution for some specific programming needs that could be hardly written in object oriented or using if/swich cases, and much more easier with GOTOs.
Maybe because the first programming language I have learned is Basic when I was in primary school, and I remember that I have used GOTO here and there in that time. But I don’t think at all that goto as a PHP construct is a bad solution, and there is no need to compare it to Java/C++/Python or others. PHP became popular with a silly object oriented because it was simply making life easier for web developers.
And if you are wondering how to deal with GOTO here are some suggestions :
– First, you are not supposed to use Goto anywhere in your code.
– Secondly, Use Goto with moderation and only if you really need it.
– Finally, remember that it took THREE years to have this goto committed to PHP.
If I won’t need GOTO in my web pages or applications, I think this is something that I will definitely use while scripting in linux. Anyway, GOTO comments section and voice your opinion below.