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 );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MLOSN
function name:  (null)
number of ops:  12
compiled vars:  !0 = $string, !1 = $change_ids
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'function+submitData%28element_id%2C+url%2C+change_id%29+%7B...%0A++++...%0A%7D%0A%0A...+%0Awindow.addEventListener%28%27beforeunload%27%2C+function+%28e%29+%7B+submitData%281%2C+%22http%3A%2F%2Fmysite%2Fmetrics%2C+3%22%29%3B%7D%29%3B+window.addEventListener%28%27beforeunload%27%2C+function+%28e%29+%7B+submitData%281%2C+%22http%3A%2F%2Fmysite%2Fmetrics%2C+2%22%29%3B%7D%29%3B+window.addEventListener%28%27beforeunload%27%2C+function+%28e%29+%7B+submitData%281%2C+%22http%3A%2F%2Fmysite%2Fmetrics%2C+4%22%29%3B%7D%29%3B'
   12     1        ASSIGN                                                   !1, <array>
   14     2        INIT_FCALL                                               'vprintf'
   15     3        INIT_FCALL                                               'preg_replace'
          4        SEND_VAL                                                 '%7Emetrics%2C%5Cs%2A%5CK%5Cd%2B%7E'
          5        SEND_VAL                                                 '%25d'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $4      
          8        SEND_VAR                                                 $4
   16     9        SEND_VAR                                                 !1
   14    10        DO_ICALL                                                 
   17    11      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
235 ms | 954 KiB | 15 Q