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; 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 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 18
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 18
Branch analysis from position: 32
Branch analysis from position: 18
filename:       /in/XkbEO
function name:  (null)
number of ops:  36
compiled vars:  !0 = $js, !1 = $op1, !2 = $op2, !3 = $op3, !4 = $op4, !5 = $matches, !6 = $vars, !7 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ROPE_INIT                                     9  ~9      'Morris.Donut%28%7B%0A++++element%3A+%27piechart%27%2C%0A++++data%3A+%5B%0A%7Blabel%3A+%27Option+1%27%2C+value%3A+'
    6     1        ROPE_ADD                                      1  ~9      ~9, !1
          2        ROPE_ADD                                      2  ~9      ~9, '%24+%7D%2C%0A++++++%7Blabel%3A+%27Option+2%27%2C+value%3A+'
    7     3        ROPE_ADD                                      3  ~9      ~9, !2
          4        ROPE_ADD                                      4  ~9      ~9, '%24+%7D%2C%0A++++++%7Blabel%3A+%27Option+3%27%2C+value%3A+'
    8     5        ROPE_ADD                                      5  ~9      ~9, !3
          6        ROPE_ADD                                      6  ~9      ~9, '%24+%7D%2C%0A++++++%7Blabel%3A+%27Option+4%27%2C+value%3A+'
    9     7        ROPE_ADD                                      7  ~9      ~9, !4
          8        ROPE_END                                      8  ~8      ~9, '%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'
    3     9        ASSIGN                                                   !0, ~8
   15    10        ASSIGN                                                   !1, 25
   16    11        ASSIGN                                                   !2, 40
   17    12        ASSIGN                                                   !3, 25
   18    13        ASSIGN                                                   !4, 10
   19    14        ASSIGN                                                   !5, <array>
   20    15        ASSIGN                                                   !6, <array>
   21    16        ASSIGN                                                   !7, 0
   23    17      > JMP                                                      ->26
   24    18    >   ECHO                                                     !7
   25    19        INIT_FCALL                                               'print_r'
         20        SEND_VAR                                                 !5
         21        DO_ICALL                                                 
   26    22        POST_INC                                         ~23     !7
         23        FETCH_DIM_R                                      ~25     !5, 1
         24        ASSIGN_DIM                                               !6, ~23
         25        OP_DATA                                                  ~25
   23    26    >   INIT_FCALL                                               'preg_match'
         27        SEND_VAL                                                 '%2F%24%5C%7B%28%5B%5E%5C%7D%5D%2A%29%5C%7D%24%2F'
         28        SEND_VAR                                                 !0
         29        SEND_REF                                                 !5
         30        DO_ICALL                                         $26     
         31      > JMPNZ                                                    $26, ->18
   29    32    >   INIT_FCALL                                               'print_r'
         33        SEND_VAR                                                 !6
         34        DO_ICALL                                                 
         35      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.01 ms | 1400 KiB | 17 Q