The constant used to learn php at the front end and the constant used to learn php* Directory [1] definition constant [2] constant detection [3] system constant [4] before magic constant
Constants do not exist in javascript. in php, they are
Php constants. Naming rules for constants: the same naming rules as variables: define () function format: define (constant name, value); example: define (PI, 3.14 ); constants and variables are the same: 1: naming rules for naming constants
Naming:
PHP constant knowledge sorting, php constant knowledge sorting
Constants in PHP are divided into custom constants and system constants.
Constant features:
After setting, the constant value cannot be changed.
The constant name does not need to
A constant in PHP object-oriented PHP5. In PHP5, constants defined by const are different from those defined by variables. you do not need to add a $ modifier. ConstPI3.14. The constant names defined by const are generally capitalized. in PHP5, the
1. Custom Constants
* Must be defined with function define ()* The value can not be changed after the definition is finished* Use the constant name directly, not as a variable in front plus $sFor example: Define ("PI", 3.14); Define a constant$area
PHP constant definitions and value constants are assigned when defined, cannot be changed, cannot be destroyed, have super-global action, and constants can only store scalar data (character integer float);PHP Define ("Hello", "World");// variable
1 Simple Assignment1 // Preliminary simple to assign a constant value of 2 define('PI ', 3.14); 3 Echo PI2 Parametric analysisDefine (name, Value,bool)First parameter Name constant names are generally named in uppercase. A second parametervalue
1. Structure and call (instantiation ):
Class className {}, call: $ obj = new className (); when the class has a constructor, you should also input parameters. For example, $ obj = new className ($ v, $ v2 ...);
2. constructor and destructor:1.
I. Structure and call (instantiation): classclassName {}, call: $ obj = newclassName (); when a class has a constructor, you should also input parameters. For example, $ obj = newclassName ($ v, $ v2 & hellip;); 2: constructor and Destructor: 1.
1. Understanding PHP Code Identification
It is very easy to write PHP code in the page, such as the following code:
Just as you can write JavaScript scripting languages that need to be written between tags, you can write PHP code in the
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.