Determine whether a variable is considered to be empty.
But in my memory, for a long time, I always thought that empty should be able to determine whether a thing is empty, until one day I was like this "empty(trim($a ))" when using it, and then I checked the manual and found out that the empty function can only judge whether a variable is empty, but cannot judge whether a string (or other value, including function return value) is empty. Although I knew that this was only a superficial reason, I did not understand the deeper reasons.
I recently became interested in the php kernel, and thought of this problem again, so I wrote the following code based on other people's experience:
Copy the code The code is as follows:
echo "< pre>";
$tokens = token_get_all('');
foreach($tokens as $t){
if (is_array($t)){
printf("%s t %s n", token_name($t[0]), htmlspecialchars($t[1]));
The result output is as follows: (If you don’t understand this, please take a look at the "List of Parser Tokens" part of the appendix of the php manual)
T_OPEN_TAG T_EMPTY empty