Core Function GetVarObjType
From Sputnik Wiki
(Difference between revisions)
(→Return Value) |
(→Example) |
||
Line 44: | Line 44: | ||
$a = "My value"; | $a = "My value"; | ||
− | if( GetVarObjType($a) == | + | if( GetVarObjType($a) == 9 ) // Server |
{ | { | ||
} | } |
Revision as of 21:33, 26 April 2012
GetVarObjType( $variable )
Contents |
Description
Get the common object type of a variable (If it is an object)
Parameters
variable
The variable to check.
Return Value
Returns the common object type a variable as a numeric value types are:
[CODE] [TYPE] [@MACRO] 0 CLASS @typeCLASS 1 FILE @typeFILE 2 BINARY @typeBINARY 3 ASSEMBLY @typeASSEMBLY 4 METHOD @typeMETHOD 5 MYSQL @typeMYSQL 6 MYSQLDATA @typeMYSQLDATA 7 DLLSTRUCT @typeDLLSTRUCT 8 OBJECT @typeOBJECT 9 SERVER @typeSERVER 10 CLIENT @typeCLIENT 11 GUIObject @typeGUIObject 12 SOCKET @typeSOCKET
Remarks
None.
Example
Checking as numeric
$a = "My value"; if( GetVarObjType($a) == 9 ) // Server { } switch( GetVarObjType($a) ) { case 9: // DLLStruct { } break; case 10: // Object (Unknown object that doesn't have its own type in Sputnik yet most likely) { } break; }
Checking using @ Macro of the numeric
$a = "My value"; if( GetVarObjType($a) == @typeCLIENT ) { } switch( GetVarObjType($a) ) { case @typeCLASS: { } break; case @typeMYSQLDATA: { } break; }