 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Please explain what happens when PHP switch case executes case 0?
The PHP is a loosely typed language. When you match with case 0 the string matches with closest integer.
Let’s say we have the following switch expression −
switch ("match") Now, we will match with case 0 −
case 0: echo " 0 with match"; break;
We will also match for non-zero case −
case "match": echo "match successful"; break;
Example
<!DOCTYPE html> <html> <body> <?php switch ("match") {    case 0:        echo " 0 with match";        break;    case "match":        echo "match successful";        break;    } ?> </body> </html>  Output
0 with match
Advertisements
 