PHP CHAPTER 00

PHP Home

PHP is a server-side scripting language used to create dynamic websites and web applications.

📘

What is it?

PHP is a server-side scripting language used to create dynamic websites and web applications.

💡

Why do we use it?

PHP is useful for creating dynamic pages, forms, login systems, dashboards, APIs and database-driven applications.

⚙️

How does it work?

The browser requests a PHP page. The web server processes the PHP code and sends the generated HTML response to the browser.

🧩

Syntax

PHP Syntax
<?php
// PHP code here
?>
💻

Example

PHP Example
<?php

echo "Welcome to AIFA Infotech PHP Coding Lab!";

?>
🔍

Example Explained

<?php starts PHP mode. echo sends text to the browser. The semicolon ends the statement. ?> closes PHP mode.
🚀

More Examples

<?php $name = "AIFA Student"; echo "Hello, " . $name; ?>

⚠️ Important Rules

PHP files normally use the .php extension. PHP must be processed by a PHP server such as XAMPP or a cPanel PHP server.

❌ Common Mistakes

Opening a PHP file directly from File Explorer instead of using localhost. Forgetting the PHP opening tag.

🌍 Real-World Use

PHP is widely used for websites, admin panels, student portals, e-commerce systems and CMS applications.

📝 Practice Exercise

Create a PHP page that displays your name, city, course and institute name.

💻 Try It Yourself

Write and run this PHP lesson inside the AIFA Coding Lab.

Open Coding Lab →