How can I remove left spaces from a string using php?

Hello friends Today, through this tutorial, I will tell you how to remove left spaces from a string using php. So let’s go.

Example code

<?php 
$str = "     Hello World";
$o = ltrim($str);
echo strlen($o);
?>