PHP goto

The PHP goto operator can be used to jump to another section in the program.
It some time there are multiple number of loops, and you have to exit and goto some specified loop.
Then you can use multiple break. But this is so inonimous.
Therefore in place of multi-level break, goto is use.
PHP goto is followed by target label.
Target label is a section where has to jump.
Target label must be within the same file and context.
You cannot jump out of a function or method.

 

Example

Output:

 

Ankit Wasankar

Senior Java Developer
Java 11 | Microservices | Reactjs | SQL

Help others by sharing the content!

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.