🐘

PHP Beginner

Variables, strings, arrays, loops and functions, run by a simulated interpreter.

4 lessons 7 tasks ⚡ Live compiler
Lessons Compiler Quiz Certificate

📚 Lessons

1 Echo, variables and strings

PHP code lives between <?php ?> tags. Variables start with $. echo outputs text; . concatenates strings.

<?php
$name = "World";
$greeting = "Hello, " . $name . "!";
echo $greeting;
echo "\n";
echo "Length: " . strlen($greeting);

2 Numbers and math

PHP supports integers and floats with the usual operators and functions like pow() and round().

<?php
$a = 7;
$b = 3;
echo "Sum: " . ($a + $b) . "\n";
echo "Product: " . ($a * $b) . "\n";
echo "Power: " . pow($a, 2);

3 Arrays and loops

Arrays store lists or maps. Iterate with foreach.

<?php
$fruits = array("apple", "banana", "cherry");
foreach ($fruits as $fruit) {
  echo "- " . $fruit . "\n";
}
echo "Count: " . count($fruits);

4 Conditions and functions

Use if/else for decisions and function to reuse logic.

<?php
function grade($score) {
  if ($score >= 90) return "A";
  elseif ($score >= 70) return "B";
  else return "C";
}
echo "Score 95 -> " . grade(95) . "\n";
echo "Score 72 -> " . grade(72);

⚡ PHP Compiler

Code runs on a learning-oriented simulated runtime that supports common constructs (output, variables, arithmetic, conditionals and loops).

PHP

            

📝 Tasks

7 tasks across 3 pages — multiple-choice and fill-in (type the answer). Score 70% or higher to earn your certificate.

🎓 Certificate of Completion

🔒 Pass the quiz above (70%+) to unlock your downloadable certificate.