Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Php method to delete the last character after the output

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

In this issue, the editor will bring you the method of deleting the last character after the php output. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

1. Use the substr and strlen functions to delete the last character.

2. Directly use the substr function to cut out the last character in reverse order.

3. Use rtrim to delete the white space character at the end of the string.

Method 1:

Substr ($arr_str,0,strlen ($arr_str)-1)

First use the strlen () function to determine the length of the string $arr_str, and then use the substr () function to intercept $arr_str to the penultimate digit of $arr_str. In this way, the last "," is removed.

Method 2:

Substr ($arr_str, 0,-1)

Method 3:

Rtrim ($arr_str, ",") the above is the way for Xiaobian to delete the last character after the php output shared by you. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report