fork download
  1. <?php
  2. $s = 'Files("textfile1.txt", 7268474425, "textfile2.txt", 661204928, "textfile3.txt", 121034)';
  3.  
  4. if (preg_match_all('/(?:\w+\(\h*|(?<!\A)\G\h*,\h*)"(?<filename>[^"]+)"\h*,\h*(?<filesize>\d+)/', $s, $m)) {
  5. $out = array_combine ( $m['filename'], $m['filesize'] );
  6. print_r($out);
  7. }
  8. ?>
Success #stdin #stdout 0.02s 26508KB
stdin
Standard input is empty
stdout
Array
(
    [textfile1.txt] => 7268474425
    [textfile2.txt] => 661204928
    [textfile3.txt] => 121034
)