Getting Started
PHP Introduction
Understand what PHP is and create a first practical example.
PHP is a practical technology used to build real software. This introduction explains its role in plain language and gives you a small example to change.
Your first step
Read the example one line at a time. Predict the result, run it, and then change one value.
Important definitions
- PHP
- The technology explored in this course.
- Source code
- Instructions written by a developer.
- Output
- The result produced from source code.
Syntax
Use this general pattern as a reference:
PHP
<?php echo "Hello"; ?>Examples
Print text
EXAMPLE 1
<?php echo "Hello"; ?>ResultHello
Create a variable
EXAMPLE 2
<?php $name = "Ada"; ?>ResultA variable named $name.
COMPLETE EXAMPLE
<?php echo "Hello, PHP!"; ?>Expected output
Hello from PHP!
Note
Focus on the idea before memorizing punctuation.
Tip
Type the example yourself and change one part at a time.
Common mistakes
- Copying code without reading it.
- Changing several things before testing.
- Ignoring error messages.