3v4l.org

run code in 300+ PHP versions simultaneously
<?php $js = "Morris.Donut({ element: 'piechart', data: [ {label: 'Option 1', value: \${op1}\$ }, {label: 'Option 2', value: \${op2}\$ }, {label: 'Option 3', value: \${op3}\$ }, {label: 'Option 4', value: \${op4}\$ } ], colors: [\"#3228db\", \"#34225e\", \"#1abc3c\", \"#24495e\", \"#9b51b6\", \"#15a5a6\"], formatter: function (y) { return y + \"%\" } });"; //$op1 = 25; //$op2 = 40; //$op3 = 25; //$op4 = 10; $matches = array(); $vars = array(); $i=0; echo preg_replace("/$\{([^\}]*)\}$/", "here", $js); while(preg_match("/$\{([^\}]*)\}$/", $js, $matches)){ echo $i; print_r($matches); $vars[$i++] = $matches[1]; } print_r($vars);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 11
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 11
Branch analysis from position: 25
Branch analysis from position: 11
filename:       /in/dR6A7
function name:  (null)
number of ops:  29
compiled vars:  !0 = $js, !1 = $matches, !2 = $vars, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'Morris.Donut%28%7B%0A++++element%3A+%27piechart%27%2C%0A++++data%3A+%5B%0A%7Blabel%3A+%27Option+1%27%2C+value%3A+%24%7Bop1%7D%24+%7D%2C%0A++++++%7Blabel%3A+%27Option+2%27%2C+value%3A+%24%7Bop2%7D%24+%7D%2C%0A++++++%7Blabel%3A+%27Option+3%27%2C+value%3A+%24%7Bop3%7D%24+%7D%2C%0A++++++%7Blabel%3A+%27Option+4%27%2C+value%3A+%24%7Bop4%7D%24+%7D%0A++++%5D%2C%0A++++colors%3A+%5B%22%233228db%22%2C+%22%2334225e%22%2C+%22%231abc3c%22%2C+%22%2324495e%22%2C+%22%239b51b6%22%2C+%22%2315a5a6%22%5D%2C%0A++++formatter%3A+function+%28y%29+%7B+return+y+%2B+%22%25%22+%7D%0A+%7D%29%3B'
   19     1        ASSIGN                                                   !1, <array>
   20     2        ASSIGN                                                   !2, <array>
   21     3        ASSIGN                                                   !3, 0
   22     4        INIT_FCALL                                               'preg_replace'
          5        SEND_VAL                                                 '%2F%24%5C%7B%28%5B%5E%5C%7D%5D%2A%29%5C%7D%24%2F'
          6        SEND_VAL                                                 'here'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $8      
          9        ECHO                                                     $8
   24    10      > JMP                                                      ->19
   25    11    >   ECHO                                                     !3
   26    12        INIT_FCALL                                               'print_r'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                                 
   27    15        POST_INC                                         ~10     !3
         16        FETCH_DIM_R                                      ~12     !1, 1
         17        ASSIGN_DIM                                               !2, ~10
         18        OP_DATA                                                  ~12
   24    19    >   INIT_FCALL                                               'preg_match'
         20        SEND_VAL                                                 '%2F%24%5C%7B%28%5B%5E%5C%7D%5D%2A%29%5C%7D%24%2F'
         21        SEND_VAR                                                 !0
         22        SEND_REF                                                 !1
         23        DO_ICALL                                         $13     
         24      > JMPNZ                                                    $13, ->11
   30    25    >   INIT_FCALL                                               'print_r'
         26        SEND_VAR                                                 !2
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.47 ms | 1391 KiB | 20 Q