Created
April 15, 2015 23:10
-
-
Save johnsonch/2f9f65f5b06aaa55cad4 to your computer and use it in GitHub Desktop.
match_all_class_example.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$string = 'My lovely gloves are lost in the clover, Love.'; | |
$result = preg_match_all('/(\w*lo\w*)/i', $string, $matches); | |
if ($result == true) { | |
print "Found $result matches<br />"; | |
} | |
else { | |
print 'Didn\'t find a match<br />'; | |
} | |
$match_results = $matches[0]; | |
foreach($match_results as $match){ | |
echo $match."<br/>"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment