Constant _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Constant. Any PHP scripting language is created using continuous statements. A statement can be a value assignment statement, a function call, a loop, a condition statement, or even a PHP script language that does not do anything, is created using a continuous statement. A statement can be a value assignment statement, a function call, a loop, a condition statement, or even a statement (an empty statement) that does not do anything ). Statements often end with semicolons. In addition, you can use volume support to compress a group of statements so that the statements can be grouped into statement groups. A statement group is a statement about itself. Different statement types are described in this chapter.
Constant
PHP defines some constants that are provided to the structure so that it can define more types at runtime. Constants are similar to variables, but they are slightly different in syntax.
The predefined constants are _ FILE _ and _ LINE __. when processing them, they are found to match the FILE name and row number. See the following example:
 
Example 6-1. Using _ FILE _ and _ LINE _ // use _ FILE _ and _ LINE __
Function report_error ($ file, $ line, $ message ){
Echo "An error occured in $ file on line $ line: $ message .";
}
Report_error (_ FILE __,__ LINE __, "Something went wrong! ");
?>
You can use the define () and undefine () functions to define other constants.
 
Example 6-2. Defining Constants // define a constant
Define ("CONSTANT", "Hello world .");
Echo CONSTANT; // outputs "Hello world ."
Undefine ("CONSTANT ");
?>

Bytes. A statement can be a value assignment statement, a function call, a loop, a condition statement, or even one that does not do anything...

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.