If it is a simple string truncation, we usually use the substr function or use mb_substr to intercept the characters. However, sometimes we find that it is not as simple as intercepting a mix of Chinese and English strings, in this case, we need to
This article introduces the use and difference of the string interception function in PHP, substr (), Mb_substr () and mb_strcut, and it is necessary for friends to refer to it.First, look at the substr function. The PHP substr () function is used
For Chinese PHP programming under UTF8, read Chinese PHP programming under UTF8. To be honest, sandal also thinks UTF8 is a good thing ...... After all, the screen shows that China, Japan, and South Korea are very attractive to East Asians ......
Php function substr intercepts Chinese characters with garbled characters solution
This article describes how to use the php string truncation function substr to intercept Chinese characters and troubleshoot garbled characters. For more
How to obtain the value 'think: ["aaa", "bbb"]'
How can I obtain aaa and bbb in it?
Reply to discussion (solution)
Substr () function Baidu Always follow Blog: http://www.phpthinking.com/
Substr () function Baidu Always follow Blog:
String ' think:["AAA", "BBB"] '
What do I have to do with the AAA and BBB inside?
Reply to discussion (solution)
SUBSTR () function own BaiduAlways Follow blogs: http://www.phpthinking.com/
SUBSTR () function own BaiduAlways Follow blogs:
These four functions in PHP are often confusing, and here are some notes to take.
1, Strstr
strstr-displays the string that was found for the first time, to find, and subsequent strings. Case sensitive.
Code Listing:
[PHP]strstr function$email = '
Differences and usage of PHPsubstr (), mb_substr () and mb_strcut and differences between the PHPsubstr () function and the truncate regulator in the Smarty Template, however, if the text to be split contains Chinese characters, you can use
Php Chinese string truncation question ??? Because the use of the substr () function to intercept Chinese strings will cause problems, I found a function online, as follows: PHPcode Chinese string intercept function functioncut_str ($ string, $
Differences and usage of PHP substr (), mb_substr () and mb_strcut and the introduction of the truncate regulator in the Smarty TemplateThe PHP substr () function can split text. However, if the text to be split contains Chinese characters, the
In php, these four functions are often confusing. Take notes here.
1. strstr
Strstr-displays the string to be searched and the subsequent string found for the first time. Case sensitive.
Code List:
[Php]// Strstr Function$ Email = 'ruxing1715 @ sina.
Built-in objects in jsJavaScript charAt () function string. charAt (n) -- returns the character of the specified position (n)
CharIs the abbreviation of character, Chinese "symbol, character"
URL:
This chapter describes several common internal functions of PHP Strings. The internal functions of PHP Strings described below include echo, print, strlen, trim, ltrim, rtrim, substr, strtolower, strtoupper, and str_replace.
Echo and printFor
The Substr function method in JavaScript is to return a substring of the specified length starting at the specified position. How to use:Stringvar.substr (start [, length])Where Stringvar is a required option. The string literal or string object to
Common PHP functions in project development
Date operation
To facilitate storage, comparison, and transmission, we usually need to use the strtotime () function to convert a date to a UNIX timestamp. date () is used only when it is displayed to
Php mb_substr () function to intercept Chinese strings
The substr () function is used to intercept strings, but there may be problems with Chinese characters. The mb_substr () and mb_strcut functions can be used. The following describes how to use
Strlen ("string");//Take the length of the string strcmp ("string", "string"); Determines whether two strings are the same, returns 0, differs by 1, and is case-sensitive strcasecmp ("string", "string"); Determine whether two strings are the same,
PHP中获取文件扩展名的N种方法 从网上收罗的,基本上就以下这几种方式:第1种方法:function get_extension($file){substr(strrchr($file, ‘.‘), 1);}notes:The STRRCHR () function finds the last occurrence of a string in another string and returns all characters from that position to the end of
PHP string get substr with strstr function PHP string getUsed to get the specified string from a string.The relevant functions are as follows:
SUBSTR (): Get a portion of it from a string
Strstr (): Finds the position of the first
In the JS character interception function has commonly used three slice (), substring (), substr (), let me introduce you to the slice (), substring (), substr () function in the character interception of some usage and difference it. Take three
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.