Hello!

BrainTech - software solutions, web design and applications.

Contact

Module 2 – PHP Fundamentals Lesson

Data Types

Scalar, compound, and special types

Basic types: string, int, float, bool. Compound: array, object. Special: null, resource. Functions gettype() and var_dump() help with learning. Casting: (int), (string), (bool). Strict mode declare(strict_types=1) requires exact types when calling functions.

Common mistakes

  • Comparison "5" == 5 is true, but "5" === 5 is false.
  • Empty string "" and 0 can give unexpected results in if conditions.
<?php
$aktivan = true;
$ocena = 9.5;
$korisnik = null;
var_dump($aktivan, $ocena, $korisnik);

Example variation

Extend the lesson example: add another variable, change the loop boundary or branching, and observe the output. Deliberately introduce an error (e.g. an undefined variable) to see the PHP message – then fix it.

Design Wireframe
High Fidelity Design
Design development
Design development
Design development
Research development