note 106323 added to control-structures.goto

From: Date: Thu, 27 Oct 2011 13:59:03 +0000
Subject: note 106323 added to control-structures.goto
Groups: php.notes 
Request: Send a blank email to php-notes+get-184169@lists.php.net to get a copy of this message
You cannot implement a Fortran-style "computed GOTO" in PHP because the label cannot be a variable. See: http://en.wikipedia.org/wiki/Considered_harmful <?php // RAY_goto.php error_reporting(E_ALL); // DEMONSTRATE THAT THE GOTO LABEL IS CASE-SENSITIVE goto a; echo 'Foo'; a: echo 'Bar'; goto A; echo 'Foo'; A: echo 'Baz'; // CAN THE GOTO LABEL BE A VARIABLE? $a = 'abc'; goto $a; // NOPE: PARSE ERROR echo 'Foo'; abc: echo 'Boom'; ---- Server IP: 192.41.42.26 Probable Submitter: 98.169.58.122 ---- Manual Page -- http://www.php.net/manual/en/control-structures.goto.php Edit -- https://master.php.net/note/edit/106323 Del: integrated -- https://master.php.net/note/delete/106323/integrated Del: useless -- https://master.php.net/note/delete/106323/useless Del: bad code -- https://master.php.net/note/delete/106323/bad+code Del: spam -- https://master.php.net/note/delete/106323/spam Del: non-english -- https://master.php.net/note/delete/106323/non-english Del: in docs -- https://master.php.net/note/delete/106323/in+docs Del: other reasons-- https://master.php.net/note/delete/106323 Reject -- https://master.php.net/note/reject/106323 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#184169) next »