[PHP] couper une chaine => tableau
Résolu
diocey
-
diocey -
diocey -
Bonjour,
j'ai un ptit soucis.
je veux faire une fonction php:
Au depard j'ai une chaine de caractère du style: "font:ariblk.ttf;fontSize:12;colorText:FF0000;colorBg:FFFFFF;"
et j'aimerias qu'a la fin de la fonction j'ai un tableau du style:
tab["font"] = "ariblk";
tab["fontSize"]="12";
tab["colorText"] = "FF0000";
tab["colorBg"] = "FFFFFF";
Voila, pour l'instant j'ai fait ca:
public static function parseStyle($str) {
$tabstyle = array();
$attributs = explode(';', $str);
foreach($attributs as $value){
$divis = explode(':',$attributs);
}
}
mais je bloque, ca ne fonctionne pas bien sur, mais j'y connais pas grand chose...
Si vous pouviez m'aider ca serias cool
Par avance merci
Gwen
j'ai un ptit soucis.
je veux faire une fonction php:
Au depard j'ai une chaine de caractère du style: "font:ariblk.ttf;fontSize:12;colorText:FF0000;colorBg:FFFFFF;"
et j'aimerias qu'a la fin de la fonction j'ai un tableau du style:
tab["font"] = "ariblk";
tab["fontSize"]="12";
tab["colorText"] = "FF0000";
tab["colorBg"] = "FFFFFF";
Voila, pour l'instant j'ai fait ca:
public static function parseStyle($str) {
$tabstyle = array();
$attributs = explode(';', $str);
foreach($attributs as $value){
$divis = explode(':',$attributs);
}
}
mais je bloque, ca ne fonctionne pas bien sur, mais j'y connais pas grand chose...
Si vous pouviez m'aider ca serias cool
Par avance merci
Gwen
A voir également:
- [PHP] couper une chaine => tableau
- Tableau word - Guide
- Tableau ascii - Guide
- Couper une video - Guide
- Trier un tableau excel - Guide
- Imprimer tableau excel sur une page - Guide
ct pas si catastophique que ca, ce que j'avias commencer finalement!
merci encore!