Edit report at http://bugs.php.net/bug.php?id=48669&edit=1
ID: 48669 Comment by: thehazard 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: 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). Previous Comments: ------------------------------------------------------------------------ [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; ------------------------------------------------------------------------ [2009-06-23 23:56:29] der...@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php . ------------------------------------------------------------------------ [2009-06-23 23:46:57] iwannalive at hotmail dot com Description: ------------ PHP 5.3 includes goto. This is a problem. Seriously, PHP has made it this far without goto, why turn the language into a public menace? Reproduce code: --------------- <?php goto a; echo 'Foo'; a: echo 'Bar'; ?> Expected result: ---------------- The world will end. Actual result: -------------- The world ended. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=48669&edit=1