S
Seoffix.com
Sign In Get Pro Membership

PHP 8 Server-Side

PHP 8 Intro

Beginner PHP 20 XP

PHP 8 Intro

PHP 8 lets you type parameters and return values.

Example

<?php
function twice(int $n): int {
    return $n * 2;
}
echo twice(4);

Your task

Write greet(string $name): string that returns Hello, plus the name, then echo greet("Seoffix").

Hints

  1. Join strings with a dot
  2. Declare the return type after the parameter list

Check your understanding

Answer every question to pass.
1. Which operator joins strings in PHP?

Your answer

This lesson is checked against the lesson rules. Your code is never run on our servers.

AI Code Explainer & Translator

Runs without any outside service.
 
Mark Complete & Earn XP
Earn 20 XP after you pass the quiz. Finish every lesson in the track to earn its certificate.
Sign in to earn XP