fork download
  1. <?php
  2. $value2 = " 'time': 1376952971";
  3. if (preg_match('/^\W*time\W*: (\d+)$/', $value2, $matches)) {
  4. echo 'Yes!', PHP_EOL;
  5. var_dump($matches);
  6. } else {
  7. echo "Oh no!";
  8. }
  9.  
  10. echo PHP_EOL;
  11. var_dump($value2);
  12.  
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
Yes!
array(2) {
  [0]=>
  string(19) " 'time': 1376952971"
  [1]=>
  string(10) "1376952971"
}

string(19) " 'time': 1376952971"