Checking for a whole number in php

There may be a simpler way but I didn’t come across one except this handy function when dealing with decimal numbers.

////////////////////////////////////////////////////////////////////////////////////////////// 
//is_wholeNumber(string $value)
//Returns TRUE if a WHOLE NUMBER
//Returns FALSE if anything else (Float, String, Hex, etc)
//////////////////////////////////////////////////////////////////////////////////////////////   
function is_wholeNumber($value)
{
	if(preg_match ("/[^0-9]/", $value))
	{	return FALSE;	}
	return TRUE;
}

There is also ctype_digit but this seems to return false when using addition like so:

$numeric_string = '1'+'1';
$integer = 1+1;

if(ctype_digit($numeric_string)) { echo "true";} else { echo "false"; }  // false
if(ctype_digit($integer)){ echo "true";} else { echo "false"; }          // false 

if(is_numeric($numeric_string)){ echo "true";} else { echo "false"; }    // true
if(is_numeric($integer)){ echo "true";} else { echo "false"; }           // true

Both equal 2 yet ctype_digit returns false? , is_numeric works here but as i’m dealing with decimal places this returns true when it is not a whole number.

Credit for the function due to http://davidwalsh.name/php-validatie-numeric-digits

Javascript function to return device type

Here’s a simple JS function to return the type of device based on screen size and some other helpful variables for the main manufacturers.

// mobile check
function checkForMobile() {

	var x = screen.width;
	var y = screen.height;
	var agent = navigator.userAgent.toLowerCase();
	var mobileOS = typeof orientation != 'undefined' ? true : false;
	var touchOS = ('ontouchstart' in document.documentElement) ? true : false;
	var otherBrowser = (agent.indexOf("series60") != -1) || (agent.indexOf("symbian") != -1) || (agent.indexOf("windows ce") != -1) || (agent.indexOf("blackberry") != -1);
	var iOS = (navigator.platform.indexOf("iPhone") != -1) || (navigator.platform.indexOf("iPad") != -1) ? true : false;
	var android = (agent.indexOf("android") != -1) || (!iOS && !otherBrowser && touchOS && mobileOS) ? true : false;
	var istablet = (/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase()));
	var tablet = (istablet==true && x >= 768) ? true : false;

	// is it mobile

	if(x >= 320) {
		whichDevice = "Mobile";
	}

	if(tablet==true) {

		whichDevice = "Tablet";

	} 	

	if(x >= 800 && tablet==false) {

		whichDevice = "Desktop";

	} 

	return whichDevice;

}
       //sets the device type
	checkForMobile();

Found something better? , please let me know.