HEX
Server: Apache/2.4.41 (Amazon) OpenSSL/1.0.2k-fips PHP/5.6.40
System: Linux ip-172-31-40-18 4.14.146-93.123.amzn1.x86_64 #1 SMP Tue Sep 24 00:45:23 UTC 2019 x86_64
User: apache (48)
PHP: 5.6.40
Disabled: NONE
Upload Files
File: //var/www/html/punjabcabs/vendor/nikic/php-parser/test/code/parser/stmt/if.test
If/Elseif/Else
-----
<?php

if      ($a) {}
elseif  ($b) {}
elseif  ($c) {}
else         {}

if ($a) {} // without else

if      ($a):
elseif  ($b):
elseif  ($c):
else        :
endif;

if ($a): endif; // without else
-----
array(
    0: Stmt_If(
        cond: Expr_Variable(
            name: a
        )
        stmts: array(
        )
        elseifs: array(
            0: Stmt_ElseIf(
                cond: Expr_Variable(
                    name: b
                )
                stmts: array(
                )
            )
            1: Stmt_ElseIf(
                cond: Expr_Variable(
                    name: c
                )
                stmts: array(
                )
            )
        )
        else: Stmt_Else(
            stmts: array(
            )
        )
    )
    1: Stmt_If(
        cond: Expr_Variable(
            name: a
        )
        stmts: array(
        )
        elseifs: array(
        )
        else: null
    )
    2: Stmt_If(
        cond: Expr_Variable(
            name: a
        )
        stmts: array(
        )
        elseifs: array(
            0: Stmt_ElseIf(
                cond: Expr_Variable(
                    name: b
                )
                stmts: array(
                )
            )
            1: Stmt_ElseIf(
                cond: Expr_Variable(
                    name: c
                )
                stmts: array(
                )
            )
        )
        else: Stmt_Else(
            stmts: array(
            )
        )
        comments: array(
            0: // without else
        )
    )
    3: Stmt_If(
        cond: Expr_Variable(
            name: a
        )
        stmts: array(
        )
        elseifs: array(
        )
        else: null
    )
    4: Stmt_Nop(
        comments: array(
            0: // without else
        )
    )
)