PHP str_split() Function

The str_split() function is used to break the string into fixed - length.

Demo :



Type Text : Type Spilt No :  

Example :

Type sentance at textarea like this : PHP is a powerful language.Type Number at Text box like this : 3

If you need to split a string through array following code useful to you.


<?php
$str = "PHP is a powerful language";
$result = str_split($str,3);
print_r($result);
?>

The sentence will pass to the str_split() function.Finally output will display "Array ( [0] => PHP [1] => is [2] => a [3] => pow [4] => erf [5] => ul [6] => lan [7] => gua [8] => ge ) ".

In the str_split() function have two parameters that name is string string,int split_length. In the first parameters is used to assign the string and second parameters used to which letter you will break in the sentance.

Free Download Script :

If you need to str_split() function demo code download from following link.

Download




Content