Skip to content

Instantly share code, notes, and snippets.

@jeremejazz
Created March 12, 2013 09:12
Show Gist options
  • Save jeremejazz/5141396 to your computer and use it in GitHub Desktop.
Save jeremejazz/5141396 to your computer and use it in GitHub Desktop.
Snippet for checking if string is an integer or float
<?php
$number = '3.8';
if ((int) $number == $number) {
//it is an integer
}else{
//it is a float
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment