To split a string into parts by any whitespace character (like single space, tab, new line, etc.) as delimiter or separator in PHP, usepreg_split()function. Callpreg_split()function and pass the regular express
The input string. 输入字符串。 split_length Maximum length of the chunk. 每一段的长度。 Return Values If the optional split_length parameter is specified, the returned array will be broken down into chunks with each being split_length in length, otherwise each chunk will be one character in ...
When we need a set of small parts of the string (of a fixed number of characters), we can use chunk_split() function. It returns a defined number of characters from the string and can also add a character or string after the string....
如果separator 为空字符串(""),explode() 将返回 FALSE。如果 separator 所包含的值在 string 中找不到,那么 explode() 将返回包含 string 单个元素的数组。 如果limit 参数是负数,则返回除了最后的 -limit 个元素外的所有元素。此特性是 PHP 5.1.0 中新增的。
$instring = 0; } else {//Break up the string according to the delimiter character//Each string has extraneous delimiters around it (inc the ones we added above), so they need to be stripped off $temparray = split($splitter, substr($val, $delimlen, strlen($val)-$delimlen-$delimlen...
Split a string into smaller chunks 将字符串分割成小块 convert_cyr_string() Convert from one Cyrillic character set to another 将字符由一种 Cyrillic 字符转换成另一种 convert_uudecode() Decode a uuencoded string 解码一个 uuencode 编码的字符串 ...
arraystr_split(string$string[,int$split_length=1] )//Converts a string to an array.//将一个字符串转换为数组。 Parameters string The input string. 输入字符串。 split_length Maximum length of the chunk. 每一段的长度。 Return Values
If the string has a mix of different newline characters, or you are not sure exactly which newline character(s) the string has, then you can use the following regular expression: preg_split('/\r\n|\r|\n/', $str); For example, such could be the case when a string is coming ...
bin2hex()Converts a string of ASCII characters to hexadecimal values chop()Removes whitespace or other characters from the right end of a string chr()Returns a character from a specified ASCII value chunk_split()Splits a string into a series of smaller parts ...
split() (使用 preg_split() 替代) spliti() (使用 preg_split() 配合 ‘i’ 修正符替代) sql_regcase() mysql_db_query() (使用 mysql_select_db() 和 mysql_query() 替代) mysql_escape_string() (使用 mysql_real_escape_string() 替代) 废弃以字符串传递区域设置名称. 使用 LC_* 系列常量替代...