J'aimerais savoir à quoi preg_match
et preg_match_all
et comment les utiliser.
Réponses
Trop de publicités?
Rebecca
Points
21
Un exemple concret :
preg_match("/find[ ]*(me)/", "find me find me", $matches):
$matches = Array(
[0] => find me
[1] => me
)
preg_match_all("/find[ ]*(me)/", "find me find me", $matches):
$matches = Array(
[0] => Array
(
[0] => find me
[1] => find me
)
[1] => Array
(
[0] => me
[1] => me
)
)
preg_grep("/find[ ]*(me)/", ["find me find me", "find me findme"]):
$matches = Array
(
[0] => find me find me
[1] => find me findme
)