Examples:

@if $var == 1 && ($i + 2) == 3
// DO something...
@elseif $var == 0 && ($i + 2) == 9
// DO something else if...
@else
// DO something else
@endif

@return void
14106
public function compileConditions()
    {
        // Find if-s
        $this->prepared = preg_replace('/@if\s?(.+)/', '<?php if($1) { ?>', $this->prepared);

        // Find elseif-s
        $this->prepared = preg_replace('/@elseif\s?(.+)/', '<?php } elseif($1) { ?>', $this->prepared);

        // Find else-s
        $this->prepared = preg_replace('/@else/', '<?php } else { ?>', $this->prepared);

        // Find endif-s
        $this->prepared = preg_replace('/@endif/', '<?php } ?>', $this->prepared);
    }
527817
private function _checkVariableVariable($token) {
		if ($this->_isActive('variableVariable')) {

			if ($this->tokenizer->checkNextToken(T_VARIABLE)) {
				$msg = $this->_getMessage("VARIABLE_VARIABLE", '$' . $this->tokenizer->peekNextToken()->text);
				$this->_writeError('variableVariable', $msg);
			}
		}
	}
927983
public static function var_dump() {
        global $USER, $CONTEXT, $LINK, $RESULT;
        echo('$USER:'."\n");
        if ( ! isset($USER) ) {
            echo("Not set\n");
        } else {
            var_dump($USER);
        }
        echo('$CONTEXT:'."\n");
        if ( ! isset($CONTEXT) ) {
            echo("Not set\n");
        } else {
            var_dump($CONTEXT);
        }
        echo('$LINK:'."\n");
        if ( ! isset($LINK) ) {
            echo("Not set\n");
        } else {
            var_dump($LINK);
        }
        echo('$RESULT:'."\n");
        if ( ! isset($RESULT) ) {
            echo("Not set\n");
        } else {
            var_dump($RESULT);
        }
        echo("\n<hr/>\n");
    }
1031510
public function prepareVars()
    {
        $this->vars['cssClasses'] = implode(' ', $this->cssClasses);
        $this->vars['columns'] = $this->getVisibleColumns();
        $this->vars['columnTotal'] = $this->getTotalColumns();
        $this->vars['records'] = $this->getRecords();
        $this->vars['noRecordsMessage'] = trans($this->noRecordsMessage);
        $this->vars['showCheckboxes'] = $this->showCheckboxes;
        $this->vars['showSetup'] = $this->showSetup;
        $this->vars['showPagination'] = $this->showPagination;
        $this->vars['showPageNumbers'] = $this->showPageNumbers;
        $this->vars['showSorting'] = $this->showSorting;
        $this->vars['sortColumn'] = $this->getSortColumn();
        $this->vars['sortDirection'] = $this->sortDirection;
        $this->vars['showTree'] = $this->showTree;
        $this->vars['treeLevel'] = 0;

        if ($this->showPagination) {
            $this->vars['pageCurrent'] = $this->records->currentPage();
            // Store the currently visited page number in the session so the same
            // data can be displayed when the user returns to this list.
            $this->putSession('lastVisitedPage', $this->vars['pageCurrent']);
            if ($this->showPageNumbers) {
                $this->vars['recordTotal'] = $this->records->total();
                $this->vars['pageLast'] = $this->records->lastPage();
                $this->vars['pageFrom'] = $this->records->firstItem();
                $this->vars['pageTo'] = $this->records->lastItem();
            }
            else {
                $this->vars['hasMorePages'] = $this->records->hasMorePages();
            }
        }
        else {
            $this->vars['recordTotal'] = $this->records->count();
            $this->vars['pageCurrent'] = 1;
        }
    }
527575
public function prepareVars()
    {
        // Refresh the loaded data to support being modified by filterFields
        // @see https://github.com/octobercms/october/issues/2613
        if (!self::$onAddItemCalled) {
            $this->processExistingItems();
        }

        if ($this->previewMode) {
            foreach ($this->formWidgets as $widget) {
                $widget->previewMode = true;
            }
        }

        $this->vars['indexInputName'] = $this->indexInputName;
        $this->vars['groupInputName'] = $this->groupInputName;

        $this->vars['prompt'] = $this->prompt;
        $this->vars['formWidgets'] = $this->formWidgets;
        $this->vars['titleFrom'] = $this->titleFrom;
        $this->vars['minItems'] = $this->minItems;
        $this->vars['maxItems'] = $this->maxItems;

        $this->vars['useGroups'] = $this->useGroups;
        $this->vars['groupDefinitions'] = $this->groupDefinitions;
    }
1283925
function set($var, $value)
    {
        if (in_array($var, get_object_vars($this)))
        {
            $this->$var = $value;
        }
        else
        {
            Error::info(__FUNCTION__, $var . " does not belong to PB_Page!");
        }
    }
188329
def p_if_statement_2(self, p):
        """"""
        p[0] = self.asttypes.If(
            predicate=p[3], consequent=p[5], alternative=p[7])
        p[0].setpos(p)
768616
def evaluate_condition(condition, vars):
    ''''''
    if condition is None:
        return True
    v = evaluate_expression(condition, vars)
    if v is None:
        return False
    return v
630151
def p_IfBlock(p):
    '''
    
    '''
    if isinstance(p[1], str):
        p[0] = IfBlock(None, p[2], p[4], p[5])
    else:
        p[0] = IfBlock(p[1], p[3], p[5], p[6])
1123535
private function maybe($value, $varList) {
        switch(func_num_args()){
            case 0:
                return false;
            case 1:
                return !!$value;
            case 2:
                if (is_array($varList)) {
                    return array_search($value, $varList, true) !== false;
                }
                return $value == $varList;
            default:
                $varList = func_get_args();
                $value = array_shift($varList);
                return $this->maybe($value, $varList);
        }
    }
631827
def p_if_else(p):
    
    cond_ = p[1]
    then_ = p[3]
    else_ = p[4][0]
    endif = p[4][1]
    p[0] = make_sentence('IF', cond_, then_, make_block(else_, endif), lineno=p.lineno(2))
829092
private function checkType($var)
    {
        switch (gettype($var)) {
            case "resource":
                $this->varIsResource($var);
                break;
            case "object":
                $this->varIsObject($var);
                break;
            case "array":
                $this->varIsArray($var);
                break;
            case "NULL":
                $this->varIsNULL();
                break;
            case "boolean":
                $this->varIsBoolean($var);
                break;
            default:
                $var = ($var == "") ? "[empty string]" : $var;
                echo "<table cellspacing=0><tr>\n<td>" . $var . "</td>\n</tr>\n</table>\n";
                break;
        }
    }
1336268
def p_elseif_list(p):
    ''''''
    if len(p) == 2:
        p[0] = []
    else:
        p[0] = p[1] + [ast.ElseIf(p[4], p[6], lineno=p.lineno(2))]
231496
def p_elseif_part(p):
    
    if p[1] == 'ELSEIF':
        label_ = make_nop()  # No label
        cond_ = p[2]
    else:
        label_ = make_label(p[1], p.lineno(1))
        cond_ = p[3]

    p[0] = label_, cond_
357505
public function init($vars) {
		foreach($vars as $n => $v) {
			if($n == 'db') self::$db = $v;
			else if($n == 'error') self::$e = $v;
			else self::$add[$n] = $v;
		}
	}
819459
private static function CheckConditions(){
            $oThis = self::CreateInstanceIfNotExists();
            $oThis->sBuffer = str_replace("{else}", "<?php } else { ?>", $oThis->sBuffer);
            $oThis->sBuffer = str_replace("{endif}", "<?php } ?>", $oThis->sBuffer);
            $oThis->sBuffer = str_replace(array('{if }', '{if  }'), "<?php if(false){ ?>", $oThis->sBuffer);

            //IF
            $Offset = 0;

            while(preg_match('/{if\s*(.*?)}/i', $oThis->sBuffer, $aMatches, PREG_OFFSET_CAPTURE, $Offset)){
                $oThis->sBuffer = str_replace($aMatches[0][0], "<?php if(".$aMatches[1][0]."){ ?>", $oThis->sBuffer);
                $Offset = $aMatches[0][1]+strlen($aMatches[0][0]);
            }

            //Elseif
            $Offset = 0;

            while(preg_match('/{elseif\s*(.*?)}/i', $oThis->sBuffer, $aMatches, PREG_OFFSET_CAPTURE, $Offset)){
                $oThis->sBuffer = str_replace($aMatches[0][0], "<?php } elseif(".$aMatches[1][0]."){ ?>", $oThis->sBuffer);
                $Offset = $aMatches[0][1]+strlen($aMatches[0][0]);
            }
        }
1313798
function assign($tpl_var, $value = null)
	{
		if (is_array($tpl_var)){
			foreach ($tpl_var as $key => $val) {
				if ($key != '') {
					$this->_tpl_vars[$key] = $val;
				}
			}
		} else {
			if ($tpl_var != '')
			$this->_tpl_vars[$tpl_var] = $value;
		}
	}