I'm looking to make a statement in PHP like this:
if(preg_match("/apples/", $ref1, $matches)) OR if(preg_match("/oranges/", $ref1, $matches)) {
Then do something }
Each of those above by themselves work just fine, but I can't figure out how to make it so that if either of them is true, then to perform the function I have beneath it.
Use the |
to select one value or the other. You can use it multiple times.
preg_match("/(apples|oranges|bananas)/", $ref1, $matches)
EDIT: This post made me hungry.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With