PHP constants, PHP constants What are the _php tutorials

Source: Internet
Author: User

PHP constants, what are the PHP constants


The define () function is used to define constants. Once a constant is defined, it can no longer be changed or undefined.

Examples of defining constants:

 
  

Run

The constant name and any other PHP tags follow the same naming conventions. A valid constant name begins with a letter or underscore followed by any letter, number, or underscore.

Changshime is considered case-sensitive, and by convention constant identifiers are always uppercase, and the value cannot be changed during script execution.

To define the difference between a constant and a defined variable:

    • No dollar sign ($) before constant
    • Constants can only be defined with the Define () function, not through assignment statements
    • Constants can be defined and accessed anywhere without regard to the rules of variable scope
    • Constants cannot be redefined or undefined once defined
    • The value of a constant can only be scalar

PHP contains a number of pre-defined constants, which can be viewed in PHP manuals.

Original address: http://www.manongjc.com/php/php_constant.html

Related reading:

PHP Str_pad () function to complement string to specified length

PHP str_replace () string substitution function usage analysis and explanation

The PHP str_ireplace () function does not match the characters in a case-insensitive replacement string

The PHP str_getcsv () function parses a CSV string into an array

http://www.bkjia.com/PHPjc/1128372.html www.bkjia.com true http://www.bkjia.com/PHPjc/1128372.html techarticle PHP constants, PHP constants, which define () functions are used to define constants. Once a constant is defined, it can no longer be changed or undefined. Example of defining constants:? Phpdefine ("Consta ...

  • 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.