Loading Depth Study
Preparing your workspace
Variables store values in PHP, while data types and operators control how those values are represented and processed.
PHP variables start with a dollar sign and can hold values such as strings, integers, floats, booleans, arrays, objects, null, and other types. PHP is dynamically typed, but modern PHP also provides strong type declarations that can make code safer. Operators are used for arithmetic, comparisons, logical conditions, assignments, and other operations. Constants can store values that should not change.
A student system can store a student's name in a string, score in an integer or float, and active status in a boolean.
<?php
$name = 'Aman';
$score = 88;
$passed = true;
if ($score >= 40 && $passed) {
echo "$name passed the course.";
}The script prints 'Aman passed the course.'