logo

Palette - Make it Colorful🎨

Palette - Visual Page Builder, no design degree required.

Live Demo Download Palette

Scroll

PHP Lessons - Lesson 2 - Variables in PHP

16/04/2025, by Ivan

PHP variables are used to store values such as strings, numbers, or arrays. Once a variable is declared, it can be reused throughout your script. All variables in PHP begin with the $ symbol.

Variables are one of the core concepts in programming. To understand programming, you must have a clear understanding of what a variable is, how and where it is stored, and what happens to it during code execution. A variable is a value that can change during program execution.

PHP Lessons - Lesson 3 - PHP String Variables

16/04/2025, by Ivan

In the previous lesson, we discussed that PHP supports variables. In this lesson, we'll take a look at one type of variable — string variables.

String variables in PHP are used to store values that consist of characters. A PHP string can be saved in a variable. Below is a PHP script that assigns the text "Hello, World!" to the string variable $txt:

<?php
$txt = "Hello, World!";
echo $txt;
?>

The result of the code above: