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 = Closure::bind($cl1, null, 'A'); $bcl2 = Closure::bind($cl2, new A(), '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/PO2YT
function name:  (null)
number of ops:  27
compiled vars:  !0 = $cl1, !1 = $cl2, !2 = $bcl1, !3 = $bcl2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FPO2YT%3A6%240'
          1        ASSIGN                                                   !0, ~4
    9     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FPO2YT%3A9%241'
          3        ASSIGN                                                   !1, ~6
   13     4        INIT_STATIC_METHOD_CALL                                  'Closure', 'bind'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 null
          7        SEND_VAL                                                 'A'
          8        DO_FCALL                                      0  $8      
          9        ASSIGN                                                   !2, $8
   14    10        INIT_STATIC_METHOD_CALL                                  'Closure', 'bind'
         11        SEND_VAR                                                 !1
         12        NEW                                              $10     'A'
         13        DO_FCALL                                      0          
         14        SEND_VAR                                                 $10
         15        SEND_VAL                                                 'A'
         16        DO_FCALL                                      0  $12     
         17        ASSIGN                                                   !3, $12
   15    18        INIT_DYNAMIC_CALL                                        !2
         19        DO_FCALL                                      0  $14     
         20        ECHO                                                     $14
         21        ECHO                                                     '%0A'
   16    22        INIT_DYNAMIC_CALL                                        !3
         23        DO_FCALL                                      0  $15     
         24        ECHO                                                     $15
         25        ECHO                                                     '%0A'
         26      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FPO2YT%3A6%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PO2YT
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%2FPO2YT%3A6%240

Function %00%7Bclosure%7D%2Fin%2FPO2YT%3A9%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PO2YT
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%2FPO2YT%3A9%241

Class A: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.36 ms | 1399 KiB | 13 Q