PHP Programing language

str_split() Function in PHP
Previous Home Next
adplus-dvertising

str_split()

The str_split() function splits a string into an array.

Syntax:
str_split(string,length)

In above syntax, "string& specifies the string to split, "length" specifies the length of each array element default is 1

Example:

<?php
print_r(str_split("Gud"));
echo "<br/>";
print_r(str_split("Morning",4));
?>

Output:

Array ( [0] => G [1] => u [2] => d ) 
Array ( [0] => Morn [1] => ing )

Previous Home Next