Two commonly used ones: <?php ?>
,<script language="php"> </script>
?>, you need to open the short_open_tag command of the php.ini file
<% %>, you need to open the asp_tags directive of the php.ini file
NULL (no type)
number (number type)
callback (callback type, also called callable)
array|object
void
is_string($str)
##Super global variable
define(const_name, const_value, boolean)
count($arr)
sort(), descending order
rsort()
Array key sorting: ascending order
ksort(), descending order
krsort()
Array value sorting: ascending
asort(), descending
arsort()
foreach loop (only for arrays)
foreach($array as $key => $value) {}
__FILE__: Full path and file name of the file
__DIR__: The directory where the file is located
__FUNCTION__: Function name
__METHOD__: The method name of the class
__NAMESPACE__: The name of the current namespace
function __destruct(), called at the end of the object’s life cycle, can destroy variables
extends, PHP does not support multiple inheritance
protected
,Interface
interface
const, no need for $
Attributes or methods declared as static can be accessed directly without instantiating the class
The parent class method is declared final and cannot be overridden or inherited by subclasses
Subclass calls parent class constructor method
parent::__construct()The above is the detailed content of What beginners should know about PHP. For more information, please follow other related articles on the PHP Chinese website!