Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php function test_switch_unused(int $v) { $result = 'none'; switch($v) { ..

Decoded Output download

<?php

function test_switch_unused(int $v) {
    $result = 'none';
    switch($v) {
        case 1:
            $result = 'x';  // should warn
            return;
        case 2:
            if (rand() % 2 > 0) {
                $result = 'x';  // should not warn
                $myUnused = 'x';
                break;
            }
            $result = 'default';
            $myUnused = 'default';
            break;
    }
    echo $result;
}

function test_switch_in_loop(int $v) {
    $result = 'none';
    for ($i = 1; $i < 10; $i++) {
        switch($v) {
            case 2:
                if (rand() % 2 > 0) {
                    echo $result;
                    $myUnused = 'x';
                    break;
                }
                $result = 'default' . $i;  // should not warn
                $myUnused = 'default';
                break;
        }
    }
}
test_switch_unused(2);
test_switch_in_loop(2);
 ?>

Did this file decode correctly?

Original Code

<?php

function test_switch_unused(int $v) {
    $result = 'none';
    switch($v) {
        case 1:
            $result = 'x';  // should warn
            return;
        case 2:
            if (rand() % 2 > 0) {
                $result = 'x';  // should not warn
                $myUnused = 'x';
                break;
            }
            $result = 'default';
            $myUnused = 'default';
            break;
    }
    echo $result;
}

function test_switch_in_loop(int $v) {
    $result = 'none';
    for ($i = 1; $i < 10; $i++) {
        switch($v) {
            case 2:
                if (rand() % 2 > 0) {
                    echo $result;
                    $myUnused = 'x';
                    break;
                }
                $result = 'default' . $i;  // should not warn
                $myUnused = 'default';
                break;
        }
    }
}
test_switch_unused(2);
test_switch_in_loop(2);

Function Calls

test_switch_unused 1

Variables

$v 2
$result none

Stats

MD5 e0fdffce49f5586cee01e9ab80dc3b0e
Eval Count 0
Decode Time 88 ms