Home >> PHP >> str_split() function in PHP

str_split() function in PHP

The str_split() function used for splits a string to an array.

Syntax

str_split(string,length)

Example

print_r(str_split('Hello'));

print_r(str_split('Hello',2));

Output

Array ( [0] => H [1] => e [2] => l [3] => l [4] => o )

Array ( [0] => He [1] => ll [2] => o )

Post Your Comment

Next Questions
str_word_count() function
strcasecmp() function
strchr() function
strcmp() function
strcspn() function
strip_tags() function
stripslashes() function
stripos() function
stristr() function
strlen() function
strnatcasecmp() function
strnatcmp() function
strncasecmp() function
strncmp() function
strpbrk() function
strpos() function
strrchr() function
strrev() function
strripos() function
strrpos() function
strspn() function
strstr() function
strtok() function
strtolower() function
strtoupper() function

Copyright ©2022 coderraj.com. All Rights Reserved.