array str_split ($string_org, $splitting_length)Parametri:
La funzione accetta due parametri ed è descritta di seguito:
Input: "Hello" Output: Array ([0] = > H [1] = > e [2] = > l [3] = > l [4] = > o )Il seguente programma spiegherà come funziona la funzione str_split().
php
// Programma PHP per visualizzare str_split()
$string
=
>" Geek "
;
// Poiché il secondo argomento non è stato passato
// la stringa è suddivisa in sottostringhe di dimensione 1.
print_r (
str_split
(
$string
));
$string
=
" GeeksforGeeks "
;
// Divide la stringa in sottostringhe di dimensione 4
// e restituisce un array di sottostringhe.
print_r (
str_split
(
$string
, 4))
?>
Output:Array ([ 0] = > G [1] = > e [2] = > e [3] = > k [4] = > s) Array ([0] = > Geek [1] = > per [2] = > Geek [3] = > s)Link :
http://php.net/manual/en/ function.str-split.php