Home >Backend Development >PHP Tutorial >Detailed explanation of the use of define in php
Today I will introduce to you the usage of define in php. It introduces in detail the usage skills of using define in php to define constants. For those who are not familiar with php just now, you can take a good look at it. Let’s study. Here is an introduction to the use of define in php!
The example in this article describes the usage of define in php. Share it with everyone for your reference. The details are as follows:
<?php /* * define * */ /*第3个参数: * false -- 对大小写敏感(默认) * true -- 对大小写不敏感 * */ define("pai",3.14); define ("name","LiLei",true); function testfor($x) { for($a=$x;$a<=12;$a++) { echo "现在是$a 点:"; if($a<9) { echo "敲代码"; echo name; } else { echo "睡觉"; echo pai; } echo "<br />"; } } testfor(10); ?>
The running results are as follows:
It is 10 o'clock now: Sleeping 3.14
It is now 11 o'clock: Sleeping 3.14
It is now 12 o'clock: Sleeping 3.14
Summary:
This article explains in detail define in php through examples The usage can help friends better master it. I hope it will be helpful to your work!
Related recommendations:
The difference and usage examples of define and defined functions in php
php define constants detailed explanation
The above is the detailed content of Detailed explanation of the use of define in php. For more information, please follow other related articles on the PHP Chinese website!