Chrome Extension

Switch case in PHP

<?php
    $type = "2";
    switch($type) {
        case "1":
            echo "case 1";
            break;
        case "2":
            echo "case 2";
            break;
        default:
            break;
    }
?>
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool
Output
case 2

The switch can be used to perform different actions and execute code blocks based on different conditions. 

Was this helpful?
0 Comments
Join Devsheet Ask a Question