[ create a new paste ] login | about

Link: http://codepad.org/uoYT3WXS    [ raw code | output | fork ]

PHP, pasted on Feb 19:
<?php
$parent = "child1";
$child = "test2";

switch($parent){
    case 'child1':
        if(!isset($child)){
            echo "Only parent";
        }
        else{
            switch($child){
                case 'test1':
                    echo $child;
                    break;
                case 'test2':
                    echo $child;
                    break;
            }
        
        }
        break;

    case 'child2':
        echo 'child2';
        break;
    default:
        echo $parent;

}


?>


Output:
1
test2


Create a new paste based on this one


Comments: