The following is a summary of my PHP learning today, for reference only
1. Basic structure of PHP:
<code><span><span><?php</span>…… <span>?></span></span></code>
2. Summary of PHP variable issues:
1. To declare and use variables, you need to add '$' before the variable name
2. Except for static variables, variables declared outside functions can only be used outside the function, and variables declared within the function can only be used within the function
3. global: take variables outside the function and use them inside the function
For example:
4. static: The defined variables can be used both inside and outside the function.
For example, declare a global variable
1. Output statements: staic $x;
<code><span>echo</span><span>""</span>;</code>
3. The declaration and usage methods are the same as js
4. if...else, switch, while, for are not much different from java
5. Array
(1), ordinary array:
<code><span>$tests</span>=<span>array</span>(<span>"test1"</span>,<span>"test2"</span>,<span>"test3"</span>);</code>
use (take the first element):
<code><span>$tests</span>[<span>0</span>];</code>
(2), key-value pair array:
<code><span>$tests</span>=<span>array</span>(<span>"ket1"</span>=><span>"test1"</span>,<span>"ket2"</span>=><span>"test2"</span>,<span>"ket3"</span>=><span>"test3"</span>);</code>
use (take the first element):
<code><span>$tests</span>[<span>'key1'</span>];</code>
').text(i)); }; $numbering.fadeIn(1700); }); });