How does php remove the last few characters-PHP problem

How to remove the last few characters in php: first create a PHP sample file; then define a string; finally use the “substr($str,0,-4);” method to remove the last specified character. Recommendation: “PHP Video Tutorial” <? php $str='programming'; //Define a string $res=substr($str,-4); //Process string echo "Return the last 4 characters {$res} of {$str} string"; $res=substr($str,0,-4); //Process string echo "Return to the {$str} string to remove the last 4 characters{$res}”;?> The above is the detailed content of how PHP removes the last few characters, and more Please pay more attention to other related articles on 1024programmer.com!

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索