par
azzeryx » 19 août 2016, 09:10
Effectivement je n'ai pas vu à cause des pages...
Si par ton code tu entend ça :
Code : Tout sélectionner
$chaine_de_test='!. \!. e. \e. E. \E.';
preg_match_all("/(?:^|[^\\\])([!eE]\.)/",$chaine_de_test,$matches);
$math = var_dump($matches);
Alors j'obtient ça :
Code : Tout sélectionner
array(2) { [0]=> array(3) { [0]=> string(2) "!." [1]=> string(3) " e." [2]=> string(3) " E." } [1]=> array(3) { [0]=> string(2) "!." [1]=> string(2) "e." [2]=> string(2) "E." } } array(2) { [0]=> array(3) { [0]=> string(2) "!." [1]=> string(3) " e." [2]=> string(3) " E." } [1]=> array(3) { [0]=> string(2) "!." [1]=> string(2) "e." [2]=> string(2) "E." } } array(2) { [0]=> array(3) { [0]=> string(2) "!." [1]=> string(3) " e." [2]=> string(3) " E." } [1]=> array(3) { [0]=> string(2) "!." [1]=> string(2) "e." [2]=> string(2) "E." } } array(2) { [0]=> array(3) { [0]=> string(2) "!." [1]=> string(3) " e." [2]=> string(3) " E." } [1]=> array(3) { [0]=> string(2) "!." [1]=> string(2) "e." [2]=> string(2) "E." } }
Et si j'essay de l'integré à mon code :
Code : Tout sélectionner
if(preg_match_all("/(?:^|[^\\\])([!eE]\./",$math,$match_math))
{
foreach ($match_math[0] as $v2_math) {
$replacement_math = "<font color='purple'>".$v2_math."</font>";
$math = str_replace($v2_math, $replacement_math, $math);
$replacement_math = str_replace(".", "", $v2_math);
$math = str_replace($v2_math, $replacement_math, $math);
}
}
rien ne se passe.
Effectivement je n'ai pas vu à cause des pages... :?
Si par ton code tu entend ça :
[code]$chaine_de_test='!. \!. e. \e. E. \E.';
preg_match_all("/(?:^|[^\\\])([!eE]\.)/",$chaine_de_test,$matches);
$math = var_dump($matches);[/code]
Alors j'obtient ça :
[code]array(2) { [0]=> array(3) { [0]=> string(2) "!." [1]=> string(3) " e." [2]=> string(3) " E." } [1]=> array(3) { [0]=> string(2) "!." [1]=> string(2) "e." [2]=> string(2) "E." } } array(2) { [0]=> array(3) { [0]=> string(2) "!." [1]=> string(3) " e." [2]=> string(3) " E." } [1]=> array(3) { [0]=> string(2) "!." [1]=> string(2) "e." [2]=> string(2) "E." } } array(2) { [0]=> array(3) { [0]=> string(2) "!." [1]=> string(3) " e." [2]=> string(3) " E." } [1]=> array(3) { [0]=> string(2) "!." [1]=> string(2) "e." [2]=> string(2) "E." } } array(2) { [0]=> array(3) { [0]=> string(2) "!." [1]=> string(3) " e." [2]=> string(3) " E." } [1]=> array(3) { [0]=> string(2) "!." [1]=> string(2) "e." [2]=> string(2) "E." } }[/code]
Et si j'essay de l'integré à mon code :
[code] if(preg_match_all("/(?:^|[^\\\])([!eE]\./",$math,$match_math))
{
foreach ($match_math[0] as $v2_math) {
$replacement_math = "<font color='purple'>".$v2_math."</font>";
$math = str_replace($v2_math, $replacement_math, $math);
$replacement_math = str_replace(".", "", $v2_math);
$math = str_replace($v2_math, $replacement_math, $math);
}
} [/code]
rien ne se passe.