The execution body {} In a PHP conditional statement can be: instead? solution

Source: Internet
Author: User
The execution body {} In a PHP conditional statement can be: instead of??
The execution body {} In a PHP conditional statement can be: instead of??

A recent code that looks at someone else has found something interesting that I didn't know before, nor did I mention it in the book.

such as the normal writing of the judgment statement
if ($a ==1)
{
EXECUTE statement
}
Now it's possible to find this.
if ($a ==1):
EXECUTE statement
endif


The second kind of can actually write is also a kind of compatible writing, do not know this to performance has no effect??
Please know the friend to do a solution ....

------Solution--------------------
http://php.chinaunix.net/manual/zh/migration.if-endif.php

Earlier versions of the syntax, not recommended to use the
------Solution--------------------
The Process Control substitution syntax in PHP:

PHP provides some alternative syntax for process control, including If,while,for,foreach and switch.

The basic form of substitution syntax is to replace the left curly brace ({) with a colon (:) and the right curly brace (}) into Endif;,endwhile;,endfor;,endforeach; and Endswitch
  • 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.