πŸ“Š PHP
Q. What will be the output of the following PHP code ?
Code:
<?php
const $k = 10;
switch($k)
{
case 10:
    print "First";
    break;
case 11:
    print "Second";
    break;
default:
    print "Third";
}
?>
  • (A) Third
  • (B) Second
  • (C) Error
  • (D) First
πŸ’¬ Discuss
βœ… Correct Answer: (C) Error

Explanation: Constants cannot be used in switch cases.

Explanation by: Parvesh Kanani
Constants cannot be used in switch cases.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
169
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Parvesh Kanani
Publisher
πŸ“ˆ
86%
Success Rate