Recherche sur les Noms des fonctions php/mysql
str_split()
Définition
Convertit une chaîne de caractères en tableau - (PHP 5)Description
array str_split
( string $string
[, int $split_length
] )
Convertit une chaîne de caractères en tableau.
Liste de paramètres
- string
-
La chaîne d'entrée.
- split_length
-
Longueur maximale de chaque élément.
Valeurs de retour
Si le paramètre optionnel split_length est spécifié, le tableau retourné sera découpé en sous-parties, chacune de taille split_length , sinon, chaque sous-partie aura la taille d'un caractère.
FALSE est retourné si split_length est inférieur à 1. Si la longueur de split_length est supérieure à celle de string , la chaîne entière est retournée dans le premier (et seul) élément du tableau.
Exemples
Exemple #1 Exemple avec str_split()
<?php
$str = "Hello Friend";
$arr1 = str_split($str);
$arr2 = str_split($str, 3);
print_r($arr1);
print_r($arr2);
?>
L'exemple ci-dessus va afficher :
Array ( [0] => H [1] => e [2] => l [3] => l [4] => o [5] => [6] => F [7] => r [8] => i [9] => e [10] => n [11] => d ) Array ( [0] => Hel [1] => lo [2] => Fri [3] => end )
Bouts de code utilisant la fonction str_split()
<?php /* ... */
$k = str_split($k);
$i = 0; $i2 = 0; $r = 0;
while($i2 <= 11)
/* ... */ ?>
<?php /* ... */
if(preg_match('#[a-z-0-9]{'.$minimum[$mode].',}#', $chaine)){
$a_chaine = str_split($chaine);
$c_uniques = array_unique($a_chaine);
/* ... */ ?>
<?php /* ... */
{
return str_split($this->chaine);
}
/* ... */ ?>
<?php /* ... */
$basket .= "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789*+-()=/.,:;?_!";
$basket = str_split($basket,1);
$i = 0;
/* ... */ ?>
<?php /* ... */
foreach ($aChaine as $val) {
$this -> aMap[] = str_split (trim ($val));
}
/* ... */ ?>
Connexion
Les fonctions
Références
- addcslashes
- addslashes
- bin2hex
- chop
- chr
- chunk_split
- convert_cyr_string
- convert_uudecode
- convert_uuencode
- count_chars
- crc32
- crypt
- echo
- explode
- fprintf
- get_html_translation_table...
- hebrev
- hebrevc
- html_entity_decode
- htmlentities
- htmlspecialchars_decode...
- htmlspecialchars
- implode
- join
- levenshtein
- localeconv
- ltrim
- md5_file
- md5
- metaphone
- money_format
- nl_langinfo
- nl2br
- number_format
- ord
- parse_str
- printf
- quoted_printable_decode...
- quotemeta
- rtrim
- setlocale
- sha1_file
- sha1
- similar_text
- soundex
- sprintf
- sscanf
- str_getcsv
- str_ireplace
- str_pad
- str_repeat
- str_replace
- str_rot13
- str_shuffle
- str_split
- str_word_count
- strcasecmp
- strchr
- strcmp
- strcoll
- strcspn
- strip_tags
- stripcslashes
- stripos
- stripslashes
- stristr
- strlen
- strnatcasecmp
- strnatcmp
- strncasecmp
- strncmp
- strpbrk
- strpos
- strrchr
- strrev
- strripos
- strrpos
- strspn
- strstr
- strtok
- strtolower
- strtoupper
- strtr
- substr_compare
- substr_count
- substr_replace
- substr
- trim
- ucfirst
- ucwords
- vfprintf
- vprintf
- vsprintf





