HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: /home/mmickelson/spilicensing/vendor/nikic/php-parser/test/code/parser/stmt/switch.test
Switch
-----
<?php

switch ($a) {
    case 0:
    case 1;
    default:
}

// alternative syntax
switch ($a):
endswitch;

// leading semicolon
switch ($a) { ; }
switch ($a): ; endswitch;
-----
array(
    0: Stmt_Switch(
        cond: Expr_Variable(
            name: a
        )
        cases: array(
            0: Stmt_Case(
                cond: Scalar_LNumber(
                    value: 0
                )
                stmts: array(
                )
            )
            1: Stmt_Case(
                cond: Scalar_LNumber(
                    value: 1
                )
                stmts: array(
                )
            )
            2: Stmt_Case(
                cond: null
                stmts: array(
                )
            )
        )
    )
    1: Stmt_Switch(
        cond: Expr_Variable(
            name: a
        )
        cases: array(
        )
    )
    2: Stmt_Switch(
        cond: Expr_Variable(
            name: a
        )
        cases: array(
        )
    )
    3: Stmt_Switch(
        cond: Expr_Variable(
            name: a
        )
        cases: array(
        )
    )
)