PHP Online Compiler
Example: PHP program of decision making by using the php switch case statement
C
C++
C#
Java
Python
PHP
main.php
STDIN
Run
<?php // PHP program of decision making by using the php switch case statement $w = 4; if ($w > 0) { switch ($w) { case 1: echo "Hi\nIt's sunday on today, It's the week-off day.\n"; break; case 2: echo "Hi\nIt's monday on today, It's the working day.\n"; break; case 3: echo "Hi\nIt's tuesday on today, It's the working day.\n"; break; case 4: echo "Hi\nIt's wednesday on today, It's the working day.\n"; break; case 5: echo "Hi\nIt's thursday on today, It's the working day.\n"; break; case 6: echo "Hi\nIt's friday on today, It's the working day.\n"; break; case 7: echo "Hi\nIt's saturday on today, It's the week-off day.\n"; break; // w parameter doesn't match any case constant then It navigates to default: default: echo "Sorry, You entered the wrong week number, Kindly try again\n"; } } else { echo "Sorry didn't entered any week number!\n"; } ?>
Output
Clear
ADVERTISEMENTS