$str=\':this is a applepie :) \';
How to use PHP, Remove the first character :
Exec time for the 3 answers :
Remove the first letter by replacing the case
$str = "hello";
$str[0] = "";
// $str[0] = false;
// $str[0] = null;
// replaced by �, but ok for echo
Exec time for 1.000.000 tests : 0.39602184295654 sec
Remove the first letter with substr()
$str = "hello";
$str = substr($str, 1);
Exec time for 1.000.000 tests : 5.153294801712 sec
Remove the first letter with ltrim()
$str = "hello";
$str= ltrim ($str,'h');
Exec time for 1.000.000 tests : 5.2393000125885 sec
Remove the first letter with preg_replace()
$str = "hello";
$str = preg_replace('/^./', '', $str);
Exec time for 1.000.000 tests : 6.8543920516968 sec