The `ltrim()` function in PHP removes whitespace or other specified characters from the beginning (left side) of a string. It's been available in PHP for many versions and works the same way in PHP 8.PHP 8.1,PHP 8.2,PHP 8.3,and PHP 8.4.
Basic Syntax<?phpltrim(string $string, string $characters = " \n\r\t\v\x00"): string?>
Example 1: Basic Usage (removing default whitespace)<?php$text = " Hello World!";echo "'" . ltrim($text) . "'";// Output: 'Hello World!'?>PHP 8.2 Notes
In PHP 8.2, `ltrim()` works exactly as in previous versions. No changes or deprecations were made to this function in PHP 8.2. It remains a reliable way to trim characters from the start of strings.