How to remove the first character of string in PHP?

后端 未结 13 2304
一整个雨季
一整个雨季 2020-12-02 06:00
$str=\':this is a applepie :) \';

How to use PHP, Remove the first character :

13条回答
  •  误落风尘
    2020-12-02 06:24

    $str = substr($str, 1);
    

    See PHP manual example 3

    echo substr('abcdef', 1);     // bcdef
    

    Note:

    unset($str[0]) 
    

    will not work as you cannot unset part of a string:-

    Fatal error: Cannot unset string offsets
    

提交回复
热议问题