Core Function GetVarType

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
(Return Value)
(Example)
Line 48: Line 48:
 
$a = "My value";
 
$a = "My value";
  
if( GetVarType($a) == 10 ) // Double
+
if( GetVarType($a) == 11 ) // Double
 
{
 
{
 
}
 
}
Line 54: Line 54:
 
switch( GetVarType($a) )
 
switch( GetVarType($a) )
 
{
 
{
case 8: // UInt64
+
case 9: // UInt64
 
{
 
{
 
}
 
}
 
break;
 
break;
case 10: // Double
+
case 11: // Double
 
{
 
{
 
}
 
}

Revision as of 01:11, 3 February 2013

GetVarType( $variable )

Contents

Description

Get the common type of a variable

Parameters

variable

The variable to check.

Return Value

Returns the common type of a variable as a numeric value types are:

[CODE]		[TYPE]		[@MACRO]
0		NULL		@typeNULL
1		CHAR		@typeCHAR
2		BYTE		@typeBYTE
3		SBYTE		@typeSBYTE
4		INT16		@typeINT16
5		INT32		@typeINT32
6		INT64		@typeINT64
7		UINT16		@typeUINT16
8		UINT32		@typeUINT32
9		UINT64		@typeUINT64
10		FLOAT		@typeFLOAT
11		DOUBLE		@typeDOUBLE
12		STRING		@typeSTRING
13		REFERENCE	@typeREFERENCE
14		ARRAY		@typeARRAY
15		OBJECT		@typeOBJECT
16		ERROR		@typeERROR

Remarks

None.

Example

Checking as numeric

$a = "My value";
 
if( GetVarType($a) == 11 ) // Double
{
}
 
switch( GetVarType($a) )
{
	case 9: // UInt64
	{
	}
	break;
	case 11: // Double
	{
	}
	break;
}

Checking using @ Macro of the numeric

$a = "My value";
 
if( GetVarType($a) == @TypeDouble) // Double
{
}
 
switch( GetVarType($a) )
{
	case @TypeUInt64: // UInt64
	{
	}
	break;
	case @TypeDouble: // Double
	{
	}
	break;
}
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox