英[splɪt] 美[splɪt]

vt.Split;separate;(quickly) leave;share

n.divide;disagreement;crack;split

vi. Separated, split

Third person singular: splits Plural: splits Present participle: splitting Past tense: split Past participle: split

php str_split() function syntax

How to use the str_split() function

php The str_split() function is used to split the string into an array. The syntax is str_split(string, length). The string is divided into Divide by length to form an array.

Function:Split the string into an array

Syntax:str_split(string,length)

Parameters:

Parameter Description
string Required, required Split string
length Optional, specifies the length of each array element, defaults to 1, if length is less than 1, returns false, if length length is greater than the length of the current string, the entire string will be returned as the only element of the array.

Instructions:Split the string according to the specified length to form an array

php str_split() function example


Run instance»

Click the "Run instance" button to view the online instance

Output:

Array ( [0] => hel [1] => low [2] => orl [3] => d )

Run Instance»

Click the "Run Instance" button to view the online instance

Output:

Array ( [0] => you c [1] => an st [2] => udy p [3] => hp in [4] => php. [5] => cn )