3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = <<<JS function submitData(element_id, url, change_id) {... ... } ... window.addEventListener('beforeunload', function (e) { submitData(1, "http://mysite/metrics, 3");}); window.addEventListener('beforeunload', function (e) { submitData(1, "http://mysite/metrics, 2");}); window.addEventListener('beforeunload', function (e) { submitData(1, "http://mysite/metrics, 4");}); JS; $change_ids = [19, 7, 11]; vprintf( preg_replace('~metrics,\s*\K\d+~', '%d', $string), $change_ids );

preferences:
29.86 ms | 405 KiB | 5 Q