fork(1) download
  1. <?php
  2.  
  3. $str = <<<'__EOS__'
  4. STRING1 = "hello";
  5. "good = bye" = "good = bye";
  6. NAME = "Your name is \"%@\"";
  7. "semicolon;confusion" = "I love semicolons; I hate semicolons"; "forget new line" = "forgot new line!";
  8. __EOS__;
  9.  
  10. $re = <<<'__EOS__'
  11. /
  12. (?<key> \w++ | " (?: [^"\\]++ | \\ . )*+ " )
  13. \s*+ = \s*+
  14. (?<val> " (?: [^"\\]++ | \\ . )*+ " )
  15. \s*+ ;
  16. /x
  17. __EOS__;
  18.  
  19. preg_match_all($re, $str, $matches);
  20. var_dump($matches);
  21.  
  22.  
  23. ?>
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
array(5) {
  [0]=>
  array(5) {
    [0]=>
    string(18) "STRING1 = "hello";"
    [1]=>
    string(28) ""good = bye" = "good = bye";"
    [2]=>
    string(29) "NAME = "Your name is \"%@\"";"
    [3]=>
    string(63) ""semicolon;confusion" = "I love semicolons; I hate semicolons";"
    [4]=>
    string(39) ""forget new line" = "forgot new line!";"
  }
  ["key"]=>
  array(5) {
    [0]=>
    string(7) "STRING1"
    [1]=>
    string(12) ""good = bye""
    [2]=>
    string(4) "NAME"
    [3]=>
    string(21) ""semicolon;confusion""
    [4]=>
    string(17) ""forget new line""
  }
  [1]=>
  array(5) {
    [0]=>
    string(7) "STRING1"
    [1]=>
    string(12) ""good = bye""
    [2]=>
    string(4) "NAME"
    [3]=>
    string(21) ""semicolon;confusion""
    [4]=>
    string(17) ""forget new line""
  }
  ["val"]=>
  array(5) {
    [0]=>
    string(7) ""hello""
    [1]=>
    string(12) ""good = bye""
    [2]=>
    string(21) ""Your name is \"%@\"""
    [3]=>
    string(38) ""I love semicolons; I hate semicolons""
    [4]=>
    string(18) ""forgot new line!""
  }
  [2]=>
  array(5) {
    [0]=>
    string(7) ""hello""
    [1]=>
    string(12) ""good = bye""
    [2]=>
    string(21) ""Your name is \"%@\"""
    [3]=>
    string(38) ""I love semicolons; I hate semicolons""
    [4]=>
    string(18) ""forgot new line!""
  }
}