In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "php how to find the character of the string", the content of the explanation is simple and clear, easy to learn and understand, now please follow the editor's train of thought slowly in depth, together to study and learn "php how to find the character of the string" bar!
The method of getting characters: 1, using the substr () function, you can intercept a certain length of characters from the specified position of the string, the syntax "substr ($str, character position, 1)"; 2, using the mb_substr () function, the syntax "mb_substr ($str, character position, 1, character encoding").
Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
Php found the character of the string.
Method 1: use the substr () function
The substr () function can intercept a certain length of characters from a specified position in a string:
Substr ($string, $start, $length)
If you want to get only one character, set the $length parameter to 1.
Example:
Method 2: use the mb_substr () function
The mb_substr () function can intercept a specified part from a string. Unlike the substr () function, the mb_substr () function is valid not only for English characters, but also for Chinese characters. Its syntax format is as follows:
Mb_substr ($str, $start [, $length = NULL [, $encoding = mb_internal_encoding ()]])
$encoding: an optional parameter that represents the character encoding of $str. If omitted, internal character encoding is used.
Example:
Thank you for your reading, the above is the content of "how to find the character of a string by php". After the study of this article, I believe you have a deeper understanding of how to find the character of a string by php. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.