Edit report at http://bugs.php.net/bug.php?id=48669&edit=1
ID: 48669 Comment by: riaanvermaak at gmail dot com Reported by: iwannalive at hotmail dot com Summary: PHP now includes GOTO Status: Bogus Type: Bug Package: Reproducible crash Operating System: All PHP Version: 5.3.0RC4 Block user comment: N New Comment: I don't see anything wrong with using "goto" the php manual says: "...The target label must be within the same file and context..." Surely if a programmer manages to mess up the use of this, he/she must be a complete nit·wit... I can't recommend anyone to mess up their code with a million goto's but, it may be useful. if you don't want to take on the task of determining how, when and when not, to make use of certain aspects of a language, it really is your own loss... You are then, beyond help. Previous Comments: ------------------------------------------------------------------------ [2010-10-19 07:18:50] phpbugs at ordisante dot com Why would you need GOTO for bug handling? We have a wonderful Exception system. It can do everything you want. ------------------------------------------------------------------------ [2010-10-08 20:30:31] thehazard at gmail dot com Seriously, goto is awesome and in some cases, very useful and can make the code a lot more clean. Are bad/unexperienced programmers use 'goto' to create some crazy ugly mess? I have no doubt about it, but that doesn't mean that the feature itself is the problem. The problem is the programmer's inexperience, and it is not the place of the language to teach the programmer better programming practices. Goto is great, for example, for cleanups. You put some cleanup code in the end of a function and in its body you check for several test cases where things could go wrong. If something goes wrong, you signal the error and jump directly to the cleanup with 'goto', instead of having to create a big mess of if's to test if an error has happened or not on each step, to then decide whether your function should continue executing or not. It is a primitive in pretty much any architecture (cmp, jmp/jz, etc) and used extensively in the linux kernel, for example. Anyone who complains about goto being 'dangerous' is either a blind fad follower or just believes that the language should master the programmer (and not the other way around). ------------------------------------------------------------------------ [2010-07-14 01:02:40] risto78 at gmail dot com sounds like a valid bug to me ;) ------------------------------------------------------------------------ [2010-05-07 14:41:11] anil at ozselgin dot com It makes php more buggy and suitable only for small programs. Is there anybody out there like readable code. ------------------------------------------------------------------------ [2009-08-04 18:47:50] and...@php.net goto hell; ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=48669 -- Edit this bug report at http://bugs.php.net/bug.php?id=48669&edit=1