TN Online TestSamacheer Kalvi practice

PHP: Hypertext Preprocessor - Study Notes

Share this chapter: Telegram

Chapter Summary

PHP (Hypertext Preprocessor) is a server-side scripting language used to build dynamic web pages. PHP code sits inside an HTML page and runs on the web server, and it works alongside HTML, CSS and JavaScript to produce pages that can read from a database. This chapter covers the basic syntax, how to declare variables, the data types, the echo statement for output, and the different groups of operators.

Learning Objectives

Key Concepts and Definitions

Worked Methods

Variable Declaration and Output

A PHP variable name starts with a dollar sign, and you create it simply by assigning a value, as in $marks = 92;. PHP is loosely typed: you do not declare a type, and the variable takes the type of the value you give it. $avg = 88.5; makes a float, and $name = "Kavin"; makes a string. The echo statement prints values. It can take several items separated by commas, as in echo $name, $avg;, or one string joined with the dot operator, as in echo "Name: " . $name;.

Operator Applications

Arithmetic operators such as + and % (modulus) do calculations. Comparison operators such as >= test how two values relate. Logical operators join conditions: AND (&&) is true only if both conditions are true, and OR (||) is true if at least one is. The increment (++) and decrement (--) operators can be written before the variable (prefix) or after it (postfix), and the position decides whether the value is changed before or after it is used.

Common Exam Traps

Exam Tips

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 Formula SheetAll key formulas

More chapters in Computer Applications

View all
1 Multimedia 2 An Introduction to Adobe PageMaker 3 Introduction to Database Management System 5 Functions and Arrays in PHP 6 Conditional Statements 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)