3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private static $sfoo = 1; public $ifoo = 2; } $cl1 = static function() { return A::$sfoo; }; $cl2 = function() { return $this->ifoo; }; $x = new A(); $x->ifoo=3; $bcl1 = Closure::bind($cl1, null, 'A'); $bcl2 = Closure::bind($cl2, $x, '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/pKnY0
function name:  (null)
number of ops:  30
compiled vars:  !0 = $cl1, !1 = $cl2, !2 = $x, !3 = $bcl1, !4 = $bcl2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FpKnY0%3A6%240'
          1        ASSIGN                                                   !0, ~5
    9     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FpKnY0%3A9%241'
          3        ASSIGN                                                   !1, ~7
   12     4        NEW                                              $9      'A'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !2, $9
          7        ASSIGN_OBJ                                               !2, 'ifoo'
          8        OP_DATA                                                  3
   13     9        INIT_STATIC_METHOD_CALL                                  'Closure', 'bind'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 null
         12        SEND_VAL                                                 'A'
         13        DO_FCALL                                      0  $13     
         14        ASSIGN                                                   !3, $13
   14    15        INIT_STATIC_METHOD_CALL                                  'Closure', 'bind'
         16        SEND_VAR                                                 !1
         17        SEND_VAR                                                 !2
         18        SEND_VAL                                                 'A'
         19        DO_FCALL                                      0  $15     
         20        ASSIGN                                                   !4, $15
   15    21        INIT_DYNAMIC_CALL                                        !3
         22        DO_FCALL                                      0  $17     
         23        ECHO                                                     $17
         24        ECHO                                                     '%0A'
   16    25        INIT_DYNAMIC_CALL                                        !4
         26        DO_FCALL                                      0  $18     
         27        ECHO                                                     $18
         28        ECHO                                                     '%0A'
   17    29      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FpKnY0%3A6%240

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

End of function %00%7Bclosure%7D%2Fin%2FpKnY0%3A9%241

Class A: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.1 ms | 1403 KiB | 13 Q