You are here : phpstringstr_split

str_split() - string

Converts a string to an array.
Parameters :
  • string - The input string.
  • split_length - Maximum length of the chunk.

  • Syntax

    array str_split
        ( string $string
       [, int $split_length = 1
      ] )


    Example

    <?php$str = "Hello Friend";$arr1 = str_split($str);$arr2 = str_split($str, 3);print_r($arr1);print_r($arr2);?>


    Output / Return Value


    Limitations


    Alternatives / See Also


    Reference