Skip to main content

Type Introspection

typeof — Get variable type

Returns the intrinsic data type as a string ('undefined', 'null', 'bool', 'int', 'float', 'string', 'array', 'function', 'macro', 'class'):

XML
<set var="name">iXML</set>
<typeof var="name" var_result="type"/>
<output>$type</output>
<!-- string -->

Full reference →


instanceof — Check class membership

Checks whether a variable is an instance of a given class or its subclasses:

XML
<class var="Animal"/>
<class var="Dog">
<extends class="Animal"/>
</class>

<new class="Dog" var="rex"/>
<instanceof class="Animal" var="rex" var_result="isAnimal"/>
<output>$isAnimal</output>
<!-- 1 (TRUE) -->

Full reference →


classinfo — Reflect on class structure

Returns an array with class metadata (prototype, parents, constructors, inheritance chain).

Full reference →


equals — Strict equality

Checks strict equality without type coercion — the string "123" and integer 123 are not equal:

XML
<set var="str">123</set>
<set var="num">123</set>
<cast var="num" type="int"/>

<equals var1="str" var2="num" var_result="eq"/>
<!-- eq is FALSE because types differ -->

Full reference →