@larissa
In PHP, you can get the length of a string using the strlen()
function. Here's an example:
1 2 3 |
$string = "Hello, world!"; $length = strlen($string); echo $length; // Output: 13 |
In the example above, the strlen()
function takes the string $string
as an argument and returns its length, which is then stored in the variable $length
. Finally, the length is displayed using the echo
statement.