Loading...

PHP search string

David Carr

1 min read - 1st Jun, 2019

Here's a quick way to search for a word inside a string, using strpos the string to look at and the word to look for. Upon a match, true is returned.

$string = 'https://api.domain.com/files';

if (strpos($string, 'api') !== false) {
    echo 'true';
}

 

0 comments
Add a comment