3v4l.org

run code in 500+ PHP versions simultaneously
<?php $a = 1; $b = 2; $x = [1, 2]; file_put_contents('/tmp/a.php', ''); class Foo { public $a = 1; public static $b = 3; function bar() {} static function baz() {} } static $array = [1, 2, 3]; static $arrayDimFetch = [1,2][0]; static $arrayItem = ['a' => 1]; static $binaryBitwiseAnd = 1 & 2; static $binaryConcat = "a" . "b"; static $binaryIdentical = 1 === 1; static $binaryPlus = 1 + 2; static $binarySpaceship = 1 <=> 2; static $bitwiseNot = ~1; static $booleanAnd = 1 && 2; static $booleanNot = !false; static $classConstFetch = Foo::class; static $coalesce = 1 ?? 2; static $constFetch = PHP_EOL; static $new = new stdClass(); static $scalarFloat = 3.14; static $scalarInteger = 123; static $scalarMagicConst = __LINE__; static $scalarString = 'string'; static $ternary = true ? 1 : 2; static $unaryPlus = +1; // Was invalid inside a function but valid outside static $propertyFetch = (new Foo())->a; // works when not in a function static $nullsafePropertyFetch = (new Foo())?->a; // works when not in a function // Fatal errors in PHP 8.2 for each statement below static $arrowFunction = fn() => 1; static $assign = ($a = 1); static $assignOpAnd = ($a &= 1); static $assignOpConcat = ($a .= "b"); static $assignOpDiv = ($b /= 2); static $assignRef = ($a =& $b); static $castInt = (int)"1"; static $clone = clone (new stdClass()); static $closure = function () { return 1; }; static $closureUse = function () use ($x) {}; static $empty = empty(1); static $encapsed = "Value: $a"; static $errorSuppress = @new stdClass(); static $eval = eval('1+1;'); static $funcCall = strlen('x'); static $include = include '/tmp/a.php'; static $instanceof = new stdClass() instanceof Foo; static $isset = isset($x); static $list = [[$a, $b] = [1, 2]]; static $match = match (1) {1 => 'a', default => 'b'}; static $methodCall = (new Foo())->bar(); static $nullsafeMethodCall = (new Foo())?->bar(); static $postInc = $a++; static $print = print ''; static $shellExec = `whoami`; // expected warning due to sandbox environment static $staticCall = Foo::baz(); static $staticPropertyFetch = Foo::$b; static $variable = $a;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 111, Position 2 = 112
Branch analysis from position: 111
1 jumps found. (Code = 42) Position 1 = 114
Branch analysis from position: 114
1 jumps found. (Code = 42) Position 1 = 116
Branch analysis from position: 116
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 112
1 jumps found. (Code = 42) Position 1 = 116
Branch analysis from position: 116
filename:       /in/n2q2Z
function name:  (null)
number of ops:  151
compiled vars:  !0 = $a, !1 = $b, !2 = $x, !3 = $array, !4 = $arrayDimFetch, !5 = $arrayItem, !6 = $binaryBitwiseAnd, !7 = $binaryConcat, !8 = $binaryIdentical, !9 = $binaryPlus, !10 = $binarySpaceship, !11 = $bitwiseNot, !12 = $booleanAnd, !13 = $booleanNot, !14 = $classConstFetch, !15 = $coalesce, !16 = $constFetch, !17 = $new, !18 = $scalarFloat, !19 = $scalarInteger, !20 = $scalarMagicConst, !21 = $scalarString, !22 = $ternary, !23 = $unaryPlus, !24 = $propertyFetch, !25 = $nullsafePropertyFetch, !26 = $arrowFunction, !27 = $assign, !28 = $assignOpAnd, !29 = $assignOpConcat, !30 = $assignOpDiv, !31 = $assignRef, !32 = $castInt, !33 = $clone, !34 = $closure, !35 = $closureUse, !36 = $empty, !37 = $encapsed, !38 = $errorSuppress, !39 = $eval, !40 = $funcCall, !41 = $include, !42 = $instanceof, !43 = $isset, !44 = $list, !45 = $match, !46 = $methodCall, !47 = $nullsafeMethodCall, !48 = $postInc, !49 = $print, !50 = $shellExec, !51 = $staticCall, !52 = $staticPropertyFetch, !53 = $variable
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 1
    4     1        ASSIGN                                                       !1, 2
    5     2        ASSIGN                                                       !2, <array>
    6     3        INIT_FCALL                                                   'file_put_contents'
          4        SEND_VAL                                                     '%2Ftmp%2Fa.php'
          5        SEND_VAL                                                     ''
          6        DO_ICALL                                                     
   15     7        BIND_STATIC                                                  !3
   16     8        BIND_STATIC                                                  !4
   17     9        BIND_STATIC                                                  !5
   18    10        BIND_STATIC                                                  !6
   19    11        BIND_STATIC                                                  !7
   20    12        BIND_STATIC                                                  !8
   21    13        BIND_STATIC                                                  !9
   22    14        BIND_STATIC                                                  !10
   23    15        BIND_STATIC                                                  !11
   24    16        BIND_STATIC                                                  !12
   25    17        BIND_STATIC                                                  !13
   26    18        BIND_STATIC                                                  !14
   27    19        BIND_STATIC                                                  !15
   28    20        BIND_STATIC                                                  !16
   29    21        BIND_INIT_STATIC_OR_JMP                                      !17
         22        NEW                                                  $58     'stdClass'
         23        DO_FCALL                                          0          
         24        BIND_STATIC                                                  !17, $58
   30    25        BIND_STATIC                                                  !18
   31    26        BIND_STATIC                                                  !19
   32    27        BIND_STATIC                                                  !20
   33    28        BIND_STATIC                                                  !21
   34    29        BIND_STATIC                                                  !22
   35    30        BIND_STATIC                                                  !23
   38    31        BIND_INIT_STATIC_OR_JMP                                      !24
         32        NEW                                                  $60     'Foo'
         33        DO_FCALL                                          0          
         34        FETCH_OBJ_R                                          ~62     $60, 'a'
         35        BIND_STATIC                                                  !24, ~62
   39    36        BIND_INIT_STATIC_OR_JMP                                      !25
         37        NEW                                                  $63     'Foo'
         38        DO_FCALL                                          0          
         39        JMP_NULL                                             ~65     $63
         40        FETCH_OBJ_R                                          ~65     $63, 'a'
         41        BIND_STATIC                                                  !25, ~65
   42    42        BIND_INIT_STATIC_OR_JMP                                      !26
         43        DECLARE_LAMBDA_FUNCTION                              ~66     [0]
         44        BIND_STATIC                                                  !26, ~66
   43    45        BIND_INIT_STATIC_OR_JMP                                      !27
         46        ASSIGN                                               ~67     !0, 1
         47        BIND_STATIC                                                  !27, ~67
   44    48        BIND_INIT_STATIC_OR_JMP                                      !28
         49        ASSIGN_OP                                        10  ~68     !0, 1
         50        BIND_STATIC                                                  !28, ~68
   45    51        BIND_INIT_STATIC_OR_JMP                                      !29
         52        ASSIGN_OP                                         8  ~69     !0, 'b'
         53        BIND_STATIC                                                  !29, ~69
   46    54        BIND_INIT_STATIC_OR_JMP                                      !30
         55        ASSIGN_OP                                         4  ~70     !1, 2
         56        BIND_STATIC                                                  !30, ~70
   47    57        BIND_INIT_STATIC_OR_JMP                                      !31
         58        ASSIGN_REF                                           $71     !0, !1
         59        BIND_STATIC                                                  !31, $71
   48    60        BIND_STATIC                                                  !32
   49    61        BIND_INIT_STATIC_OR_JMP                                      !33
         62        NEW                                                  $72     'stdClass'
         63        DO_FCALL                                          0          
         64        CLONE                                                ~74     $72
         65        BIND_STATIC                                                  !33, ~74
   50    66        BIND_INIT_STATIC_OR_JMP                                      !34
         67        DECLARE_LAMBDA_FUNCTION                              ~75     [1]
         68        BIND_STATIC                                                  !34, ~75
   51    69        BIND_INIT_STATIC_OR_JMP                                      !35
         70        DECLARE_LAMBDA_FUNCTION                              ~76     [2]
         71        BIND_LEXICAL                                                 ~76, !2
         72        BIND_STATIC                                                  !35, ~76
   52    73        BIND_INIT_STATIC_OR_JMP                                      !36
         74        BIND_STATIC                                                  !36, <false>
   53    75        BIND_INIT_STATIC_OR_JMP                                      !37
         76        NOP                                                          
         77        FAST_CONCAT                                          ~77     'Value%3A+', !0
         78        BIND_STATIC                                                  !37, ~77
   54    79        BIND_INIT_STATIC_OR_JMP                                      !38
         80        BEGIN_SILENCE                                        ~78     
         81        NEW                                                  $79     'stdClass'
         82        DO_FCALL                                          0          
         83        END_SILENCE                                                  ~78
         84        BIND_STATIC                                                  !38, $79
   55    85        BIND_INIT_STATIC_OR_JMP                                      !39
         86        INCLUDE_OR_EVAL                                      $81     '1%2B1%3B', EVAL
         87        BIND_STATIC                                                  !39, $81
   56    88        BIND_INIT_STATIC_OR_JMP                                      !40
         89        BIND_STATIC                                                  !40, 1
   57    90        BIND_INIT_STATIC_OR_JMP                                      !41
         91        INCLUDE_OR_EVAL                                      $82     '%2Ftmp%2Fa.php', INCLUDE
         92        BIND_STATIC                                                  !41, $82
   58    93        BIND_INIT_STATIC_OR_JMP                                      !42
         94        NEW                                                  $83     'stdClass'
         95        DO_FCALL                                          0          
         96        INSTANCEOF                                           ~85     $83, 'Foo'
         97        BIND_STATIC                                                  !42, ~85
   59    98        BIND_INIT_STATIC_OR_JMP                                      !43
         99        ISSET_ISEMPTY_CV                                     ~86     !2
        100        BIND_STATIC                                                  !43, ~86
   60   101        BIND_INIT_STATIC_OR_JMP                                      !44
        102        FETCH_LIST_R                                         $87     <array>, 0
        103        ASSIGN                                                       !0, $87
        104        FETCH_LIST_R                                         $89     <array>, 1
        105        ASSIGN                                                       !1, $89
        106        INIT_ARRAY                                           ~91     <array>
        107        BIND_STATIC                                                  !44, ~91
   61   108        BIND_INIT_STATIC_OR_JMP                                      !45
        109        IS_IDENTICAL                                                 1, 1
        110      > JMPNZ                                                        ~92, ->112
        111    > > JMP                                                          ->114
        112    >   QM_ASSIGN                                            ~93     'a'
        113      > JMP                                                          ->116
        114    >   QM_ASSIGN                                            ~93     'b'
        115      > JMP                                                          ->116
        116    >   BIND_STATIC                                                  !45, ~93
   62   117        BIND_INIT_STATIC_OR_JMP                                      !46
        118        NEW                                                  $94     'Foo'
        119        DO_FCALL                                          0          
        120        INIT_METHOD_CALL                                             $94, 'bar'
        121        DO_FCALL                                          0  $96     
        122        BIND_STATIC                                                  !46, $96
   63   123        BIND_INIT_STATIC_OR_JMP                                      !47
        124        NEW                                                  $97     'Foo'
        125        DO_FCALL                                          0          
        126        JMP_NULL                                             $99     $97
        127        INIT_METHOD_CALL                                             $97, 'bar'
        128        DO_FCALL                                          0  $99     
        129        BIND_STATIC                                                  !47, $99
   64   130        BIND_INIT_STATIC_OR_JMP                                      !48
        131        POST_INC                                             ~100    !0
        132        BIND_STATIC                                                  !48, ~100
   65   133        BIND_INIT_STATIC_OR_JMP                                      !49
        134        ECHO                                                         ''
        135        BIND_STATIC                                                  !49, 1
   66   136        BIND_INIT_STATIC_OR_JMP                                      !50
        137        INIT_FCALL                                                   'shell_exec'
        138        SEND_VAL                                                     'whoami'
        139        DO_ICALL                                             $101    
        140        BIND_STATIC                                                  !50, $101
   67   141        BIND_INIT_STATIC_OR_JMP                                      !51
        142        INIT_STATIC_METHOD_CALL                                      'Foo', 'baz'
        143        DO_FCALL                                          0  $102    
        144        BIND_STATIC                                                  !51, $102
   68   145        BIND_INIT_STATIC_OR_JMP                                      !52
        146        FETCH_STATIC_PROP_R              unknown             ~103    'b'
        147        BIND_STATIC                                                  !52, ~103
   69   148        BIND_INIT_STATIC_OR_JMP                                      !53
        149        BIND_STATIC                                                  !53, !0
   70   150      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/n2q2Z
function name:  {closure:/in/n2q2Z:42}
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   42     0  E > > RETURN                                                       1
          1*     > RETURN                                                       null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/n2q2Z
function name:  {closure:/in/n2q2Z:50}
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   50     0  E > > RETURN                                                       1
          1*     > RETURN                                                       null

End of Dynamic Function 1

Dynamic Function 2
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/n2q2Z
function name:  {closure:/in/n2q2Z:51}
number of ops:  2
compiled vars:  !0 = $x
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   51     0  E >   BIND_STATIC                                                  !0
          1      > RETURN                                                       null

End of Dynamic Function 2

Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/n2q2Z
function name:  bar
number of ops:  1
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E > > RETURN                                                       null

End of function bar

Function baz:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/n2q2Z
function name:  baz
number of ops:  1
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E > > RETURN                                                       null

End of function baz

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.23 ms | 1501 KiB | 15 Q