CKTIS / PHP
ltrim()
Remove matching bytes from the left until the first byte outside the mask.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
ltrim(string $string, string $characters = " \n\r\t\v\x00"): stringRemove matching bytes from the left until the first byte outside the mask. The optional mask is a set, not a prefix, and can include ranges such as 0..9. The right edge is untouched. The default includes NUL but does not include every Unicode whitespace character.
Signature
ltrim(string $string, string $characters = " \n\r\t\v\x00"): string
Example output
["file20","Qba","A "]
Examples
<?php
echo json_encode([ltrim("120file20","0..9"),ltrim("abbaQba","ab"),ltrim("\0 A ")]);
Result
["file20","Qba","A "]