fork(2) download
  1. <?php
  2.  
  3. $string = '
  4. ```codechanger
  5. ``php
  6. <?php ?>
  7. ``
  8. ``c#
  9. $foo = bar;
  10. ``
  11. ```
  12. ';
  13.  
  14. preg_match_all('~```codechanger(.*?)```~s', $string, $matches_codechanger);
  15.  
  16. //print_r($matches_codechanger);
  17.  
  18.  
  19.  
  20. foreach ($matches_codechanger[1] AS $matches) {
  21.  
  22. preg_match_all('~``.*?\n(.*?)``~si', $matches, $matches_language);
  23.  
  24. print_r($matches_language[1]);
  25.  
  26. }
  27.  
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
Array
(
    [0] => <?php ?>

    [1] => $foo = bar;

)