How can I get the last 7 characters of a PHP string?

后端 未结 7 2115
太阳男子
太阳男子 2020-11-30 18:25

How would I go about grabbing the last 7 characters of the string below?

For example:

$dynamicstring = \"2490slkj409slk5409els\";
$newstring = some_f         


        
7条回答
  •  被撕碎了的回忆
    2020-11-30 18:52

    For simplicity, if you do not want send a message, try this

    $new_string = substr( $dynamicstring, -min( strlen( $dynamicstring ), 7 ) );
    

提交回复
热议问题