3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL); function exec_eval($code) { try { $result = @eval($code); $err = error_get_last(); return [$result, $err ? $err["message"] . PHP_EOL : $err/* // PHP5 */]; } catch(\Error $e) { // PHP7 return [null, $e->getMessage()]; } catch(\Exception $ex) { return [null, $ex->getMessage()]; } } var_dump(exec_eval("xdfadsfsd"));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s7Tde
function name:  (null)
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 32767
          2        DO_ICALL                                                 
   16     3        INIT_FCALL                                               'var_dump'
          4        INIT_FCALL                                               'exec_eval'
          5        SEND_VAL                                                 'xdfadsfsd'
          6        DO_FCALL                                      0  $1      
          7        SEND_VAR                                                 $1
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function exec_eval:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 18
Branch analysis from position: 18
2 jumps found. (Code = 107) Position 1 = 19, Position 2 = 25
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
2 jumps found. (Code = 107) Position 1 = 26, Position 2 = -2
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 25
Branch analysis from position: 25
filename:       /in/s7Tde
function name:  exec_eval
number of ops:  32
compiled vars:  !0 = $code, !1 = $result, !2 = $err, !3 = $e, !4 = $ex
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    6     1        BEGIN_SILENCE                                    ~5      
          2        INCLUDE_OR_EVAL                                  $6      !0, EVAL
          3        END_SILENCE                                              ~5
          4        ASSIGN                                                   !1, $6
    7     5        INIT_FCALL                                               'error_get_last'
          6        DO_ICALL                                         $8      
          7        ASSIGN                                                   !2, $8
    8     8        INIT_ARRAY                                       ~10     !1
          9      > JMPZ                                                     !2, ->14
         10    >   FETCH_DIM_R                                      ~11     !2, 'message'
         11        CONCAT                                           ~12     ~11, '%0A'
         12        QM_ASSIGN                                        ~13     ~12
         13      > JMP                                                      ->15
         14    >   QM_ASSIGN                                        ~13     !2
         15    >   ADD_ARRAY_ELEMENT                                ~10     ~13
         16      > RETURN                                                   ~10
         17*       JMP                                                      ->31
    9    18  E > > CATCH                                                    'Error', ->25
   10    19    >   INIT_ARRAY                                       ~14     null
         20        INIT_METHOD_CALL                                         !3, 'getMessage'
         21        DO_FCALL                                      0  $15     
         22        ADD_ARRAY_ELEMENT                                ~14     $15
         23      > RETURN                                                   ~14
         24*       JMP                                                      ->31
   11    25  E > > CATCH                                       last         'Exception'
   12    26    >   INIT_ARRAY                                       ~16     null
         27        INIT_METHOD_CALL                                         !4, 'getMessage'
         28        DO_FCALL                                      0  $17     
         29        ADD_ARRAY_ELEMENT                                ~16     $17
         30      > RETURN                                                   ~16
   14    31*     > RETURN                                                   null

End of function exec_eval

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.17 ms | 1403 KiB | 20 Q