3v4l.org

run code in 300+ PHP versions simultaneously
<?php function evalJS($code) { $code = preg_replace('#var #', '\$', $code); $code = preg_replace('#.#', '->', $code); $code = preg_replace('#(\'|")\+#', '$1.', $code); $code = preg_replace('#\+(\'|")', '.$1', $code); eval($code); } class document { public function print($arg) { echo($arg); } } $js = <<<JS var foo = 'Hello '+'World!'; document.print(foo); JS; evalJS($js);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cP0sJ
function name:  (null)
number of ops:  5
compiled vars:  !0 = $js
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   ASSIGN                                                   !0, 'var+foo+%3D+%27Hello+%27%2B%27World%21%27%3B%0Adocument.print%28foo%29%3B'
   22     1        INIT_FCALL                                               'evaljs'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0          
          4      > RETURN                                                   1

Function evaljs:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cP0sJ
function name:  evalJS
number of ops:  27
compiled vars:  !0 = $code
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 '%23var+%23'
          3        SEND_VAL                                                 '%5C%24'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $1      
          6        ASSIGN                                                   !0, $1
    5     7        INIT_FCALL                                               'preg_replace'
          8        SEND_VAL                                                 '%23.%23'
          9        SEND_VAL                                                 '-%3E'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $3      
         12        ASSIGN                                                   !0, $3
    6    13        INIT_FCALL                                               'preg_replace'
         14        SEND_VAL                                                 '%23%28%27%7C%22%29%5C%2B%23'
         15        SEND_VAL                                                 '%241.'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                         $5      
         18        ASSIGN                                                   !0, $5
    7    19        INIT_FCALL                                               'preg_replace'
         20        SEND_VAL                                                 '%23%5C%2B%28%27%7C%22%29'
         21        SEND_VAL                                                 '.%241'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                         $7      
         24        ASSIGN                                                   !0, $7
    8    25        INCLUDE_OR_EVAL                                          !0, EVAL
    9    26      > RETURN                                                   null

End of function evaljs

Class document:
Function print:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cP0sJ
function name:  print
number of ops:  3
compiled vars:  !0 = $arg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   14     1        ECHO                                                     !0
   15     2      > RETURN                                                   null

End of function print

End of class document.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
200.43 ms | 1402 KiB | 16 Q