fork download
  1. <?php
  2.  
  3. $string = "orders,items,friends,students OrdeRs or orders OR stuDents or FrIends or students";
  4.  
  5. preg_match_all('/(orders|items|friends|students)/i', $string, $result, PREG_PATTERN_ORDER);
  6. for ($i = 0; $i < count($result[1]); $i++) {
  7. echo $result[1][$i]."\n";
  8. }
  9.  
  10.  
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
orders
items
friends
students
OrdeRs
orders
stuDents
FrIends
students