(string) / strval()
Converts the value to text.
Syntax
(string)$value · strval($value)
Description
Converts number to text (often automatic in echo/concatenation).
Example
Loading editor…
Expected output
Age: 36
When to use?
Concatenation, representation. (Concatenation in PHP is with a dot: . )
Common mistakes
- ⚠️ In PHP, string concatenation uses a DOT (.) not a +: "a" . "b".