PHP basics

Your first program, variables and types, and working with text.

About 4 hours of study

Learning objectives

Lessons

  1. 1

    Your first PHP program

    How a PHP file is laid out, printing with echo, print and printf, and the difference between single and double quotes.

  2. 2

    Variables and types

    Variables, the types int, float, string, bool and null, type conversion with casts, division and constants.

  3. 3

    Strings

    Joining text with the dot, trimming, searching, cutting and changing strings with the most useful functions.

Module practice

Module quiz

1. Which tag opens PHP code?
2. Which symbol starts every variable name in PHP?
3. Which operator joins two strings?
4. What does 7 / 2 give in PHP?
5. Which function gives the position of a word inside a string?
6. What does (int) 3.99 return?

Input, decisions and loops ›