1 / 8

Goto Statement in PHP - Learn in 20 Mins

Goto statement is only available in latest version of PHP and its PHP 5.3 or higher PHP versions.

dynaaddison
Download Presentation

Goto Statement in PHP - Learn in 20 Mins

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Go to Statement in PHP Prepared By www.CreativeDev.in

  2. Go To in PHP • Goto statement is only available in latest version of PHP and its PHP 5.3 or higher PHP versions.We can say Goto statement is used to jump to other section of the program. • The Goto Statement requires a label to identify the place where the branch to be made. A label is any valid variable name and must be followed by colon(:). A label is immediately placed before the statement where the control is to be transferred.

  3. The general form of Goto:

  4. Some Important Notes • The label: can be in anywhere in the program before or after the gotolabel; statement. • goto is not a function. Its just a statement. • When program run and get the statement like go to first; the flow of program will jump to the statement first: .This occurs unconditionally.

  5. Example echo "Lets start with Go To"."<br />"; goto read; echo "Skip the code with Goto jump"; read: echo "Execute the code with Goto jump";

  6. OutPUT Lets start with Go To Execute the code with Gotojump

  7. Last but not least • In the previous example, when the code encounters the goto statement, the control transfer to the label “read”. • "Dont go to GO TO statement".Try to avoid the use of goto as far as possible but there is nothing wrong if we use it to improve execution speed of program.

  8. Thank You  Feel free to add your comments/queries on http://www.creativedev.in/2011/11/goto-statement-in-php/ For more articles, visit: www.creativedev.in

More Related