Skip to content

Instantly share code, notes, and snippets.

@SaoriMiyazaki
Created June 12, 2018 22:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SaoriMiyazaki/dff4188ceeac6791a4ae3988d3c18e08 to your computer and use it in GitHub Desktop.
Save SaoriMiyazaki/dff4188ceeac6791a4ae3988d3c18e08 to your computer and use it in GitHub Desktop.
<section>
<h2>1. '' 空の結果</h2>
<table>
<tr>
<th>$var値</th>
<th>isset</th>
<th>empty</th>
<th>is_null</th>
</tr>
<tr>
<th>$var = ''<?php $var = ''; ?></th>
<td><?php var_dump( isset( $var ) ); ?></td>
<td><?php var_dump( empty( $var ) ); ?></td>
<td><?php var_dump( is_null( $var ) ); ?></td>
</tr>
</table>
</section>
<section>
<h2>2. ' ' 空白の結果 </h2>
<table>
<tr>
<th>$var値</th>
<th>isset</th>
<th>empty</th>
<th>is_null</th>
</tr>
<tr>
<th>$var = ' '<?php $var = ' '; ?></th>
<td><?php var_dump( isset( $var ) ); ?></td>
<td><?php var_dump( empty( $var ) ); ?></td>
<td><?php var_dump( is_null( $var ) ); ?></td>
</tr>
</table>
</section>
<section>
<h2>3. NULL の結果 </h2>
<table>
<tr>
<th>$var値</th>
<th>isset</th>
<th>empty</th>
<th>is_null</th>
</tr>
<tr>
<th>$var = NULL<?php $var = NULL; ?></th>
<td><?php var_dump( isset( $var ) ); ?></td>
<td><?php var_dump( empty( $var ) ); ?></td>
<td><?php var_dump( is_null( $var ) ); ?></td>
</tr>
</table>
</section>
<section>
<h2>4. 整数 0 の結果 </h2>
<table>
<tr>
<th>$var値</th>
<th>isset</th>
<th>empty</th>
<th>is_null</th>
</tr>
<tr>
<th>$var = 0<?php $var = 0; ?></th>
<td><?php var_dump( isset( $var ) ); ?></td>
<td><?php var_dump( empty( $var ) ); ?></td>
<td><?php var_dump( is_null( $var ) ); ?></td>
</tr>
</table>
</section>
<section>
<h2>5. 文字列 '0' の結果 </h2>
<table>
<tr>
<th>$var値</th>
<th>isset</th>
<th>empty</th>
<th>is_null</th>
</tr>
<tr>
<th>$var = '0'<?php $var = '0'; ?></th>
<td><?php var_dump( isset( $var ) ); ?></td>
<td><?php var_dump( empty( $var ) ); ?></td>
<td><?php var_dump( is_null( $var ) ); ?></td>
</tr>
</table>
</section>
<section>
<h2>6. boolean TRUE の結果</h2>
<table>
<tr>
<th>$var値</th>
<th>isset</th>
<th>empty</th>
<th>is_null</th>
</tr>
<tr>
<th>$var = true<?php $var = true; ?></th>
<td><?php var_dump( isset( $var ) ); ?></td>
<td><?php var_dump( empty( $var ) ); ?></td>
<td><?php var_dump( is_null( $var ) ); ?></td>
</tr>
</table>
</section>
<section>
<h2>7. boolean FALSE の結果</h2>
<table>
<tr>
<th>$var値</th>
<th>isset</th>
<th>empty</th>
<th>is_null</th>
</tr>
<tr>
<th>$var = false<?php $var = false; ?></th>
<td><?php var_dump( isset( $var ) ); ?></td>
<td><?php var_dump( empty( $var ) ); ?></td>
<td><?php var_dump( is_null( $var ) ); ?></td>
</tr>
</table>
</section>
<section>
<h2>8. 空の配列の結果</h2>
<table>
<tr>
<th>$var値</th>
<th>isset</th>
<th>empty</th>
<th>is_null</th>
</tr>
<tr>
<th>$var = array()<?php $var = array(); ?></th>
<td><?php var_dump( isset( $var ) ); ?></td>
<td><?php var_dump( empty( $var ) ); ?></td>
<td><?php var_dump( is_null( $var ) ); ?></td>
</tr>
</table>
</section>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment