How to check match the first & last word from a variable in php?
In this post, we use php preg_match to match the first & last word in a variable with a given first & last specific words.
1. Code:
2. Example:
Input:
$first_word = 't'; $last_word = 'ne'; $str = 'this function can be done';
Output:
Output: true