Core Function GetVarObjType
From Sputnik Wiki
(Difference between revisions)
(→Example) |
(→Return Value) |
||
Line 31: | Line 31: | ||
11 GUIObject @typeGUIObject | 11 GUIObject @typeGUIObject | ||
12 SOCKET @typeSOCKET | 12 SOCKET @typeSOCKET | ||
+ | 13 STREAM @typeSTREAM | ||
+ | 14 FUNCTION @typeFUNCTION | ||
</pre> | </pre> | ||
Revision as of 17:23, 20 January 2013
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 13 STREAM @typeSTREAM 14 FUNCTION @typeFUNCTION
Remarks
None.
Example
Checking as numeric
$a = "My value"; if( GetVarObjType($a) == 9 ) // Server { } switch( GetVarObjType($a) ) { case 7: // DLLStruct { } break; case 8: // 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; }