In the PHP language, there are a number of functions that can be used to retrieve strings, so that PHP can also implement the search function for strings as Word does. This will be very convenient to use, it is easy to find the content you want to
In the project development, we often encounter the problem of string interception in English and Chinese, for example, the News list page needs the news content introduction, this will use the string interception.
In the project development, we
This article introduces the three functions Strtr, Str_replace and Preg_replace, which are used in PHP for string processing, in the comparative analysis of efficiency. If you need a friend, refer to it.Below compare the efficiency of STRTR,
Class Request
{
Public Function __construct ()
{
if (!GET_MAGIC_QUOTES_GPC ())
{
if (!empty ($_post))
{
foreach ($_post as $k = & $v)
{
if (Is_array ($v))
{
@array_walk ($v, ' urldecode ');
Difference between concat and concat_ws () and group_concat (), repeat () string functions 1, concat () functions
1.1 The concat function of MySQL can connect one or more strings, such
Mysql> select concat ('10 ');
+ -------------- +
| Concat ('10')
It is often annoying that the result object is an object and the content in the object cannot be viewed. You can convert the result object to the string type and print it out, the Code is as follows:
function obj2string(o){var r=[];if(typeof
Smarty Truncate intercept stringIntercepts a length of characters from the beginning of a string, with a default length of 80
Specifies the length of the second argument as the Intercept string
By default, Smarty is truncated to the end of a
Sometimes we don't want to, a web address for people to see, the simple way is to encrypt it into a string of characters, the function is as follows:
function Encrypt ($key, $plain _text) {$plain _text = Trim ($plain _text);$IV = substr (MD5 ($key),
If you do not know the encoding format of the string, you can check this character like this:
$encode = mb_detect_encoding ($string, Array ("ASCII", ' utf-8′, "gb2312′," GBK ", ' big5′));
Echo $encode;
This will tell you what the code is. Subsequent
Urlencode (PHP4, PHP5) urlencode & nbsp; & mdash; & nbsp; URL string description string & nbsp; urlencode & nbsp; (& nbsp; string & nbsp; $ str & nbsp;) This function allows you to encode a string and use it in the request section of the URL.
(PHP 4,
You often need to use java to split strings such as 1, 2, 3, 4 tom, jim, andy, and han.1. The syntax is as follows:String. split (sourceStr, maxSplit)String. split (sourceStr)Parameter description: sourceStr is the split string, and maxSplit is the
Yesterday, a server accidentally encountered an error. As a result, a batch of abnormal data was generated. You need to find a way to correct the date values contained in some fields. One of them uses a function called stuff, it is mainly used to
String functions in the PHP language are also a relatively understandable knowledge. Today we summed up nearly 12 kinds of PHP string functions, I hope that the need for friends to help, increase the reader friend's PHP knowledge base.1. Find
Strstr--Finds the first occurrence of a string, returning the string starting at the first occurrence to the end or beginning of the string.
STRISTR--Ignoring case version of the STRSTR function
STRCHR--alias of the STRSTR function
STRRCHR--
Definition and usageThe str_shuffle () function randomly shuffles all character strings.SyntaxStr_shuffle (string)ParameterDescriptionStringString required. Specify string shufflingLet's take a look at the str_shuffle function tutorial. Output
This article summarizes the string-handling functions of thinkphp and other common functions that can be used by developers for reference. Details are as follows:
Get the IP address of the client
Msubstr ($str, $start =0, $length, $charset = "Utf-8
The Lua interpreter has limited support for strings. A program can create and connect strings, but cannot intercept substrings, check the size of strings, and check the content of strings. The function of manipulating strings in Lua is basically
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.