🌱 Beginner PHP Fundamentals

Start your PHP journey here! Learn the basics with simple explanations and interactive examples.

Beginner Progress

Completed: 60%

1. Variables and Data Types

📚 What you'll learn:

  • What are variables?
  • Naming conventions
  • Data types: strings, integers, floats, booleans

📖 Explanation:

Variables in PHP are containers for storing data. They start with a $ sign followed by the variable name. PHP is loosely typed, so you don't need to declare the type.

💻 Example Code:

<?php
$name = 'John';
$age = 25;
$height = 5.9;
$is_student = true;
echo "Hello, $name! You are $age years old.";
?>
Download Example

2. Arrays

📚 What you'll learn:

  • Indexed arrays
  • Associative arrays
  • Array functions

📖 Explanation:

Arrays allow you to store multiple values in a single variable. Indexed arrays use numeric keys, while associative arrays use named keys.

💻 Example Code:

<?php
$colors = ['red', 'green', 'blue'];
$person = ['name' => 'Jane', 'age' => 30];
echo $colors[0]; // red
echo $person['name']; // Jane
?>
Download Example

3. Control Structures

📚 What you'll learn:

  • If-else statements
  • Loops (for, while, foreach)

📖 Explanation:

Control structures allow you to control the flow of your code. If-else statements execute code conditionally, and loops repeat code.

💻 Example Code:

<?php
$score = 85;
if ($score >= 60) {
    echo 'Pass';
} else {
    echo 'Fail';
}

for ($i = 0; $i < 5; $i++) {
    echo $i;
}
?>
Download Example

🎮 PHP Playground

Type your PHP code below and see the result!

Output will appear here...

🎯 PHP Match Game

Match the PHP concepts with their descriptions!

Concepts:

Descriptions:

📝 Beginner Quiz

Test your knowledge with this quick quiz!

What does PHP stand for?

📥 Beginner Resources

Download practice files and cheat sheets