3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private static $sfoo = 1; private $ifoo = 2; } $cl1 = static function() { return A::$sfoo; }; $cl2 = function() { return $this->ifoo; }; $bcl1 = $cl1->bindTo(new A(), 'A'); $bcl2 = $cl2->bindTo(null, 'A'); echo $bcl1(), "\n"; echo $bcl2(), "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/M7ov6
function name:  (null)
number of ops:  25
compiled vars:  !0 = $cl1, !1 = $cl2, !2 = $bcl1, !3 = $bcl2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FM7ov6%3A7%240'
          1        ASSIGN                                                   !0, ~4
   10     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FM7ov6%3A10%241'
          3        ASSIGN                                                   !1, ~6
   14     4        INIT_METHOD_CALL                                         !0, 'bindTo'
          5        NEW                                              $8      'A'
          6        DO_FCALL                                      0          
          7        SEND_VAR_NO_REF_EX                                       $8
          8        SEND_VAL_EX                                              'A'
          9        DO_FCALL                                      0  $10     
         10        ASSIGN                                                   !2, $10
   15    11        INIT_METHOD_CALL                                         !1, 'bindTo'
         12        SEND_VAL_EX                                              null
         13        SEND_VAL_EX                                              'A'
         14        DO_FCALL                                      0  $12     
         15        ASSIGN                                                   !3, $12
   16    16        INIT_DYNAMIC_CALL                                        !2
         17        DO_FCALL                                      0  $14     
         18        ECHO                                                     $14
         19        ECHO                                                     '%0A'
   17    20        INIT_DYNAMIC_CALL                                        !3
         21        DO_FCALL                                      0  $15     
         22        ECHO                                                     $15
         23        ECHO                                                     '%0A'
         24      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FM7ov6%3A7%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/M7ov6
function name:  {closure}
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'sfoo'
          1      > RETURN                                                   ~0
    9     2*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FM7ov6%3A7%240

Function %00%7Bclosure%7D%2Fin%2FM7ov6%3A10%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/M7ov6
function name:  {closure}
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   FETCH_THIS                                       $0      
          1        FETCH_OBJ_R                                      ~1      $0, 'ifoo'
          2      > RETURN                                                   ~1
   12     3*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FM7ov6%3A10%241

Class A: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.55 ms | 940 KiB | 14 Q