fork download
  1. <?php
  2.  
  3. $subject = "window.location.href='example.com.com.com.com.com'";
  4.  
  5. $subject = preg_replace_callback("~(?<=')(.*?)(?=')~", function($m) {return preg_replace('~\.~', '\x2e', $m[1]);}, $subject);
  6.  
  7. print $subject;
  8.  
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
window.location.href='example\x2ecom\x2ecom\x2ecom\x2ecom\x2ecom'