function cast($val) {
		if (preg_match('/^(?:0x[0-9a-f]+|0[0-7]+|0b[01]+)$/i',$val))
			return intval($val,0);
		if (is_numeric($val))
			return $val+0;
		$val=trim($val);
		if (preg_match('/^\w+$/i',$val) && defined($val))
			return constant($val);
		return $val;
	}
function cast($val) {
		if (preg_match('/^(?:0x[0-9a-f]+|0[0-7]+|0b[01]+)$/i',$val))
			return intval($val,0);
		if (is_numeric($val))
			return $val+0;
		$val=trim($val);
		if (preg_match('/^\w+$/i',$val) && defined($val))
			return constant($val);
		return $val;
	}
function cast ( $ val ) { if ( preg_match ( '/^(?:0x[0-9a-f]+|0[0-7]+|0b[01]+)$/i' , $ val ) ) return intval ( $ val , 0 ) ; if ( is_numeric ( $ val ) ) return $ val + 0 ; $ val = trim ( $ val ) ; if ( preg_match ( '/^\w+$/i' , $ val ) && defined ( $ val ) ) return constant ( $ val ) ; return $ val ; }
Cast string variable to PHP type or constant
@param $val
@return mixed
Cast string variable to PHP type or constant