Will the PHP statements that are not included in a function be executed sequentially? Is JS also like this? Not reading the textbook is Trouble Ah, so basic things have to ask. Before I heard that there are some major differences between the C language Foundation and I can use PHP directly, I really believe it.
Reply to discussion (solution)
Will the PHP statements that are not included in a function be executed sequentially? Is JS also like this?
That's theoretically true.
If you're talking about a custom function, usually placed in front of the calling statement, PHP executes in a sequential
Unless it is a magic method and function, the custom function does not execute automatically and requires a statement call
Yes, the functions in PHP can be anywhere, no matter where they are placed, they will not be executed directly.
The principle remains: Define first, then use
In the same file, you can define it first.
The PHP parser will read the entire PHP file before parsing the output, so it is possible to define it first.
However, in order to clean the specification, it is best to define and call first.