Skip to content

Instantly share code, notes, and snippets.

@n8finch
Created January 6, 2017 07:47
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 n8finch/fd6084b80267692c4899fe4f5024980d to your computer and use it in GitHub Desktop.
Save n8finch/fd6084b80267692c4899fe4f5024980d to your computer and use it in GitHub Desktop.
Quick type checking in php, outputs to browser console in admin ajax
// Quick type checking in php, outputs to browser console in admin ajax
echo 'Type: '. gettype($bc_exists) . "\n";
echo 'Null: '. is_null($bc_exists) . "\n";
echo 'Array: '. is_array($bc_exists). "\n";
echo 'isset: '. is_array($bc_exists). "\n";
echo 'Empty: '. empty($bc_exists). "\n";
echo 'Boolean: '. is_bool($bc_exists). "\n";
echo 'String: '. is_string($bc_exists). "\n";
echo 'Object: '. is_object($bc_exists). "\n";
echo 'Value Array: '. print_r($bc_exists) . "\n";
echo 'Value String: '. $bc_exists . "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment