Computer language learning is important is the practice process, if only to see, will feel very simple but to you really write a piece of code when you will find that you learn is God horse things ah! So learn the language to constantly knock knock code!
Today's study is the initial function of PHP,
1. define function
The function is to define constants
The basic syntax is define (string constant_name,mixed value,case_sentsitive=true)
A small piece of code for the exercise is:
Define ("changliangming", "How is you\n");//The constant defined is changliangming
echo changliangming. "
";//output How is You
echo changliangming. "
";//because there is no definition so the output is changliangming, because PHP is sensitive to case, so the output here is changliangming
Define ("Zhi", "I am fine\n", true);//define constant is Zhi, where true is set case insensitive
echo Zhi. "
";//The output here is Iam fine
echo Zhi. "
";//The output here is I am fine
Define ("Dazhi", "50/n");
echo dazhi;//The output here is 50.
ECHO constant ("Dazhi"). "
";//The output here is also 50,constant is used to return the value of the constant
echo (Defined ("Hanshu")). "
";//undefined so output blank line
Define ("Hanshu", "Yegehanshu");//define constants, constants named Hanshu
echo (Defined ("Hanshu")). "
";//If the definition is positive then return the 1,defined function name is used to check whether the function name has been defined
?>
Note: In general, PHP is more sensitive to the case of letters, because PHP can be nested with HTML so that HTML tags are directly written in the middle of the PHP function,
Line breaks in the middle of HTML, \ n is an escape character, and is also a newline