Obtenir un tableau de caractères depuis une chaîne en PHP4

En php5 on a str_split : http://fr.php.net/manual/fr/function.str-split.php

Et en PHP4 :

$chars = preg_split('#(?<=.)(?=.)#s', $string);
by Nicolas Perriault on 2006-10-11, tagged array  php  string 

Comments on this snippet

gravatar icon
#1 Nicolas Hoizey on 2006-11-01 at 10:30

Je suis pas pro des preg*, mais sur http://php.net/preg_split ils donnent l'exemple suivant pour "Scinder une chaîne en caractères" :

$chars = pregsplit('//', $str, -1, PREGSPLITNOEMPTY);

Quelle différence avec ta version ??

gravatar icon
#2 Nicolas Perriault on 2006-11-02 at 04:51

Quelle différence ? Heu, ça doit marcher aussi bien (à tester), après les tatillons iront bencher les perfs pendant que moi je me concentrerai sur autre chose de plus interessant :-)

gravatar icon
#3 gasser fabien on 2006-11-06 at 11:37

strtowordtab (L)

You need to create an account or log in to post a comment or rate this snippet.