Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<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
You can’t perform that action at this time.