fork(1) download
  1. <?php
  2.  
  3. // your code goes here
  4. $re = "/.*?(\\d+)x(\\d+)/m";
  5. $str = "\"resolution\": \"1024x768\"";
  6. $subst = "\"width\" : \"$1\", \"height\" : \"$2";
  7.  
  8. $result = preg_replace($re, $subst, $str);
  9. echo $result
  10. ?>
Success #stdin #stdout 0.03s 52432KB
stdin
Standard input is empty
stdout
"width" : "1024", "height" : "768"