April 2026
Intermediate
1009 pages
34h 15m
English
One of the most common tasks is to split a string into its individual parts or to create a string from individual parts. PHP offers many different functions for this alone.
In PHP, you can use square brackets to access individual letters of a string in the same way as the elements of an array. The first letter has the index 0:
$text = "Example string"; echo $text[0];
This therefore returns the result E.
In the distant past, the square brackets variant was not recommended for a while. At that time, PHP used curly brackets as an alternative to square brackets. However, this was "unusual" compared to other programming languages. For this reason, it was decided in the course of regular ...
Read now
Unlock full access