Skip to content

Instantly share code, notes, and snippets.

@Restoration
Created August 6, 2016 15:27
Show Gist options
  • Select an option

  • Save Restoration/f4c4c4f6ca0845d13c7be8156b116f92 to your computer and use it in GitHub Desktop.

Select an option

Save Restoration/f4c4c4f6ca0845d13c7be8156b116f92 to your computer and use it in GitHub Desktop.
PHPの型チェック
<?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