3v4l.org

run code in 300+ PHP versions simultaneously
<?php class interpreter { private $_code; public function __construct($code) { if(!is_string($code)) exit('Error while parsing code; Code not conformal.'); $this->_code = $code; $this->exec(); } public function parser($code = null) { $array = []; if($code === null) $code = $this->_code; if(preg_match('#print\((.*)\)#', $code, $array)) echo($array[1]); } } $code = 'print("Hello World!");'; $program = new interpreter($code);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mYbs5
function name:  (null)
number of ops:  6
compiled vars:  !0 = $code, !1 = $program
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                   !0, 'print%28%22Hello+World%21%22%29%3B'
   16     1        NEW                                              $3      'interpreter'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $3
          5      > RETURN                                                   1

Class interpreter:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mYbs5
function name:  __construct
number of ops:  10
compiled vars:  !0 = $code
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        TYPE_CHECK                                   64  ~1      !0
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->5
          4    > > EXIT                                                     'Error+while+parsing+code%3B+Code+not+conformal.'
    6     5    >   ASSIGN_OBJ                                               '_code'
          6        OP_DATA                                                  !0
    7     7        INIT_METHOD_CALL                                         'exec'
          8        DO_FCALL                                      0          
    8     9      > RETURN                                                   null

End of function __construct

Function parser:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
Branch analysis from position: 6
filename:       /in/mYbs5
function name:  parser
number of ops:  15
compiled vars:  !0 = $code, !1 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV_INIT                                        !0      null
   10     1        ASSIGN                                                   !1, <array>
   11     2        TYPE_CHECK                                    2          !0
          3      > JMPZ                                                     ~3, ->6
          4    >   FETCH_OBJ_R                                      ~4      '_code'
          5        ASSIGN                                                   !0, ~4
   12     6    >   INIT_FCALL                                               'preg_match'
          7        SEND_VAL                                                 '%23print%5C%28%28.%2A%29%5C%29%23'
          8        SEND_VAR                                                 !0
          9        SEND_REF                                                 !1
         10        DO_ICALL                                         $6      
         11      > JMPZ                                                     $6, ->14
         12    >   FETCH_DIM_R                                      ~7      !1, 1
         13        ECHO                                                     ~7
   13    14    > > RETURN                                                   null

End of function parser

End of class interpreter.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.4 ms | 1400 KiB | 15 Q