Why is goto seldom seen in PHP?

Source: Internet
Author: User
Not commonly used? Why? Not commonly used?
Why?

Reply content:

Not commonly used?
Why?

Goto should not be used, but should be used with caution. Similar to the language features such as goto, proper use is no problem.

However, if you abuse the code, you can think about the state of constantly following the goto statement while reading the code.

Some people may say that a method call does not need to be adjusted to the position of the method declaration. In fact, in the canonicalized encoding, a method is an encapsulation of a series of operations that require certain purposes, and you should know what this method is doing by naming (or document) standard methods, in this way, you will know what operations you have done in the process of reading the program and read the program more smoothly.

It is recommended not to use a goto statement as a specification rather than a mistake, just like "bad behavior should be restrained rather than banned", one of the core principles of python"

There are also goto in the C language, and almost no one has ever seen it. The structure is damaged.
The same is true for PHP.

Object-oriented languages are rarely used, and there are many in C language, but please use them with caution to avoid code confusion.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.