Afficher occurrences d'un preg_match_all
Résolu
YameFAZE
Messages postés
204
Statut
Membre
-
jordane45 Messages postés 40050 Statut Modérateur -
jordane45 Messages postés 40050 Statut Modérateur -
Bonjour,
Je cherche à afficher les occurrences d'un
Il m'affiche un
J'ai aussi essayé avec un
Je cherche à afficher les occurrences d'un
preg_match_allmais je n'y arrive pas. Il s'agit d'un
patternqui recherche des caractères spéciaux dans un champs de formulaire.
<?php
preg_match_all('#^-|-$|[-]+[-]+|\.+|,+|;+|:+|[\']+[\']+|"+|\!+|\?+|«+|»+|<+|>+|\{+|\}+|\[+|\]+|\(+|\)+|/+|\|+|\\\+|_+|=+|\++|\#+|£+|\$+|&+|§+|%+|@+|¤+|\*+|[0-9]+| +#', $_POST['registration_firstName'], $chars);
$i_while = 1;
$i = 0;
while ($i_while <= count($chars)) {
echo $chars[$i].'<br />';
$i_while++;
$i++;
}
?>
Il m'affiche un
Array to string conversion.
J'ai aussi essayé avec un
foreach, ça fonctionne à moitié, il ne m'affiche que la première occurrence trouvée.
<?php
foreach ($chars as $chars) {
echo $chars[$i].'<br />';
$i++;
}
?>
Configuration: Windows / Firefox 72.0
A voir également:
- Afficher occurrences d'un preg_match_all
- Afficher appdata - Guide
- Afficher taille dossier windows - Guide
- Windows 11 afficher d'autres options - Guide
- Afficher mot de passe wifi android - Guide
- Afficher calendrier outlook dans google agenda - Guide