Goto Statement in PHP - Learn in 20 Mins - PowerPoint PPT Presentation

About This Presentation
Title:

Goto Statement in PHP - Learn in 20 Mins

Description:

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

Number of Views:41
Slides: 9
Provided by: dynaaddison
Category:

less

Transcript and Presenter's Notes

Title: Goto Statement in PHP - Learn in 20 Mins


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"."ltbr /gt"
  • 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 Goto jump

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-i
    n-php/
  • For more articles, visit
  • www.creativedev.in
Write a Comment
User Comments (0)
About PowerShow.com