Sortie du snippet PHP "Tester si une chaîne contient une autre chaîne avec PHP"

Environnement :

  • Strangebuzz Snippet VM : 6.4.2
  • PHP : 8.3
  • Symfony : 6.4.6

Sortie du code exécuté :

strpos: YES, Foobar is a good friend of mine! contains friend!
str_contains: YES, Foobar is a good friend of mine! contains friend!
Symfony string: YES, Foobar is a good friend of mine! contains friend!

strpos: NO, Foobar is a good friend of mine! does not contains FrIenD!
str_contains: NO, Foobar is a good friend of mine! does not contains FrIenD!
Symfony string: YES, Foobar is a good friend of mine! contains FrIenD! (ignoring case)