Created
August 6, 2016 15:27
-
-
Save Restoration/f4c4c4f6ca0845d13c7be8156b116f92 to your computer and use it in GitHub Desktop.
PHPの型チェック
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $a = 123; | |
| if(isset($a)){ | |
| echo "変数には値がセットされています"; | |
| } else { | |
| echo "変数には値がセットされていません"; | |
| } | |
| if(is_int($a)){ | |
| echo "変数はinteger型です"; | |
| } else { | |
| echo "変数はinteger型ではありません"; | |
| } | |
| if(is_string($a)){ | |
| echo "変数はstring型です"; | |
| } else { | |
| echo "変数はstring型ではありません"; | |
| } | |
| echo var_dump($a); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment