Beginner Fundamentals
Introduction to PHP
PHP is a popular programming language designed to build dynamic websites and web applications. It runs on the server, which means the code is executed before the page reaches the visitor’s browser.
What is PHP
PHP stands for “PHP: Hypertext Preprocessor”. It is open source, free to use, and powers a huge part of the web, including content management systems and online stores.
Server-side language
When a user requests a page, the server runs the PHP code and sends back plain HTML. The visitor never sees the original PHP source, only the result.
What it is used for
- Building dynamic web pages
- Reading and writing databases
- Handling forms and user input
- Creating APIs and login systems
First example
A PHP file uses the .php extension. Code lives inside <?php ... ?> tags.
<?php
echo "Hello, world!";
?>
This script prints Hello, world! to the page. The echo statement sends text to the output.