Jane
You’ve learned some of the basics of PHP in the first nine steps of this PHP tutorial. Most people are still confused after understanding the above knowledge, most understand some of the knowledge I explained how to achieve (for zero base readers), how to build a website or do not know. Never mind, next we are going to enter the ACTUAL PHP, complete a simple site to build. There is still a section or two to learn before completing the site, such as object-oriented PHP. The following is a supplement to some knowledge, only as an example, not too much explanation.
Magic constant
__FILE__ : Displays the location of the current file:
echo __FILE__;
? >
Copy the code
Results:
File directory __DIR__ :
echo __DIR__ ;
? >
Copy the code
Results:
The function name__FUNCTION__
:
function name(){
echo __FUNCTION__;
}
echo name();
? >
Copy the code
Results:
The line Numbers__LINE__
:
echo __LINE__;
? >
Copy the code
Results:
Volatile variables
Mutable variables are a fun thing to look at. Example:
$a = 'hello';
$$a = 'world';
echo $a.' '.$$a;
? >
Copy the code
$a = “a” = “a” = “a” = “hello” = “a” = “hello” = “a” = “hello”$$a = 'world';
For the value of the$hello= 'world';
.
So echo output$a.' '.$$a;
Is equal to$a.' '.$hello;
, the following output is displayed:
According to the characteristics of mutable variables can play a very fun tricks, interested can try.