In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the php variable how to remove the last character of the relevant knowledge, the content is detailed and easy to understand, the operation is simple and fast, with a certain reference value, I believe you will have something to gain after reading this php variable how to remove the last character article, let's take a look.
Get rid of the method: 1, with the "substr (variable, 0maimei 1)" statement, the last character of the English string can be cut out in reverse order; 2, with the "mb_substr (variable, 0maimei 1," character coding ")" statement, the last character of the Chinese string can be deleted; 3, with the "rtrim (variable," specified character ")" statement.
Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
The last character is removed from the variable in php
Method 1: use the substr () function
Use the substr () function to truncate the last character in reverse order (this function cannot be used for Chinese characters).
Substr ($arr_str, 0,-1)
Example:
Method 2: use the mb_substr () function
The mb_substr () function is used in the same way as the substr () function, with the last character cut in reverse order; however, it can be used for Chinese characters.
3. Use the rtrim () function
Rtrim-removes white space characters (or other characters) from the end of a string
Rtrim ($arr_str, "specified character")
Example:
Note: the rtrim () function deletes the consecutive characters on the right.
This is the end of the article on "how to remove the last character from a variable in php". Thank you for reading! I believe you all have a certain understanding of the knowledge of "how to remove the last character from a variable in php". If you want to learn more, 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.