How to remove the first character of string in PHP?

$str=':this is a applepie :) ';

How to use PHP, Remove the first character :


To remove every : from the beginning of a string, you can use ltrim:

$str = '::f:o:';
$str = ltrim($str, ':');
var_dump($str); //=> 'f:o:'

Leave a Reply

Your email address will not be published. Required fields are marked *