Blogger Information
Blog 5
fans 0
comment 0
visits 3026
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
4.12作业
Gill的博客
Original
667 people have browsed it

<?php
   $val1; //已声明未初始化;
   $val2 = null; //初始化为null
   $val3 = ''; //初始化为空字符串
   $val4 = 'yhg'; //正常赋值
   $val5 = 'y9999';
   unset($val5);//删除,等效于已声明未初始化
$val6 = 0; //值为0
$val7 = '0'; //值为0的字符串
echo '<h2>is_null</h2>'; //未初始化,初始化为null,删除后都是null;
   @print_r( is_null($val1) ? isnull : notnull);
   echo '<hr color="blue">';
   @print_r( is_null($val2) ? isnull : notnull);
echo '<hr color="blue">';
   @print_r( is_null($val3) ? isnull : notnull);
   echo '<hr color="blue">';
   @print_r( is_null($val4) ? isnull : notnull);
echo '<hr color="blue">';
   @print_r( is_null($val5) ? isnull : notnull);
echo '<hr color="blue">';
@print_r( is_null($val6) ? isnull : notnull);
echo '<hr color="blue">';
@print_r( is_null($val7) ? isnull : notnull);


echo '<hr color="red">';
echo '<h2>empty</h2>'; //为null的一定是empty,值为0和字符串0都为empty
@print_r( empty($val1) ? 'empty' : notempty);
echo '<hr color="blue">';
@print_r( empty($val2) ? 'empty' : notempty);
echo '<hr color="blue">';
@print_r( empty($val3) ? 'empty' : notempty);
echo '<hr color="blue">';
@print_r( empty($val4) ? 'empty' : notempty);
echo '<hr color="blue">';
@print_r( empty($val5) ? 'empty' : notempty);
echo '<hr color="blue">';
@print_r( empty($val6) ? 'empty' : notempty);
echo '<hr color="blue">';
@print_r( empty($val7) ? 'empty' : notempty);

echo '<hr color="red">';
echo '<h2>isset</h2>';//等同于!is_null
@print_r( isset($val1) ? 'isset' : notset);
echo '<hr color="blue">';
@print_r( isset($val2) ? 'isset' : notset);
echo '<hr color="blue">';
@print_r( isset($val3) ? 'isset' : notset);
echo '<hr color="blue">';
@print_r( isset($val4) ? 'isset' : notset);
echo '<hr color="blue">';
@print_r( isset($val5) ? 'isset' : notset);
echo '<hr color="blue">';
@print_r( isset($val6) ? 'isset' : notset);
echo '<hr color="blue">';
@print_r( isset($val7) ? 'isset' : notset);

Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post