
1. Resource is a special variable that is stored in external resources.
The resource type variables used include: open files, database connections, graphics canvas areas and other special handles. Created and recycled by programmers.
<?php
// Resource type // Use the fopen() function to open the info.txt file in the current directory in writing mode, and assign the returned file resource to $file_handle
$file_handle = fopen("info.txt","w");
var_dump($file_handle); // resource(3, stream)
fclose($file_handle);
// Use the opendir() function to open the C:\WINDOWS\Fonts directory under the Windows system and return the directory resource $dir_handle = opendir("C:\WINDOWS\Fonts");
var_dump($dir_handle); // resource(4, stream)
// Use the mysqli_connect() function to connect to the MySQL management system and return the MySQL connection resource $link_mysql = mysqli_connect("localhost", "root", "");
var_dump($link_mysql); // returns a lot of content
// Use the imagecreate() function to create a 100*50 pixel artboard and return the image resource $im_handle = imagecreate(100,50);
var_dump($im_handle); // resource(6, gd)
// Use the xml_parser_create() function to return the XML parser resource $xml_parser = xml_parser_create();
var_dump($xml_parser); // resource(7, xml)2. NULL, the special NULL means that a variable has no value, and the only possible value of the NULL type is NULL.
NULL does not represent a space, does not represent 0, nor does it represent an empty string, but represents that the variable value is empty. NULL is either a null value or an empty value; but it is not a null value, a null value is also an existing value, and NULL represents a value Doesn't exist.
<?php // NULL type $a = NULL; $b = "value"; unset($b); // Release $b var_dump($a); // null var_dump($b); // null, give a notice var_dump($c); // null, give a notice
The above are the special types of PHP variables. I hope it will be helpful to everyone.