TN Online TestSamacheer Kalvi practice

Conditional Statements in PHP - Formula Sheet

Share this chapter: Telegram

Key Operational Syntaxes and Logic Rules

While PHP conditional statements do not utilize mathematical formulas in the traditional sense, they are governed by rigid logical expressions and syntactical rules.

1. Conditional Syntax Formulas

Structure Name Syntactical Formula Rule of Execution
Simple If if (C) { S; } Executes statement S if condition C is boolean true.
If-Else if (C) { S1; } else { S2; } Executes S1 if C is true; otherwise, executes S2.
If-Elseif-Else if (C1) { S1; } elseif (C2) { S2; } else { S3; } Evaluates C1 first. If false, evaluates C2. If both are false, executes S3.
Switch-Case switch (E) { case V1: S1; break; default: Sd; } Evaluates expression E once, matches it against value V1, and runs S1. Runs Sd if no match is found.

2. Logical and Comparison Evaluation Rules

Conditions are evaluated using standard boolean logic:

Solved MCQs → Practice test →

More for this chapter

Book Back Questions10 textbook MCQs · solved Additional MCQs15 extra MCQs · solved Practice TestInteractive · instant score Book Back TestTest yourself on the textbook set Additional MCQ TestTest yourself on the extra set Study NotesConcepts & methods

More chapters in Computer Applications

View all
1 Multimedia 2 An Introduction to Adobe PageMaker 3 Introduction to Database Management System 4 PHP: Hypertext Preprocessor 5 Functions and Arrays in PHP 7 Loops in PHP 8 Forms and Files 9 Connecting PHP and MYSQL 10 Introduction to Computer Networks 11 Network Examples and Protocols 12 Domain Name System (DNS) 13 Network Cabling 14 Open Source Concepts 15 E-Commerce 16 Electronic Payment Systems 17 E-Commerce Security Systems 18 Electronic Data Interchange- EDI