Answers for "php string regex search"

PHP
1

find substring regx php

if (preg_match("/\bweb\b/i", "PHP is the web scripting language of choice.")) {
    echo "A match was found.";
} else {
    echo "A match was not found.";
}
Posted by: Guest on May-26-2020
1

string match in php

//str_contains ( string $haystack , string $needle ) : bool

if (str_contains('Foo Bar Baz', 'Foo')) {
  echo 'Found';
}
Posted by: Guest on April-18-2021

Browse Popular Code Answers by Language