3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bar { private $a; public function __construct($a) { $this->a = (bool) $a; } public function a() { return $this->a; } } function foo(callable $x) { $object = new Bar(false); $x($object); return $object->a(); } var_dump(\Closure::bind(function () { $this->a = true;} , 'Bar', 'Bar'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gYklr
function name:  (null)
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_STATIC_METHOD_CALL                                  'Closure', 'bind'
          2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FgYklr%3A25%240'
   26     3        SEND_VAL                                                 ~0
   27     4        SEND_VAL                                                 'Bar'
          5        SEND_VAL                                                 'Bar'
          6        DO_FCALL                                      0  $1      
          7        SEND_VAR                                                 $1
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gYklr
function name:  foo
number of ops:  12
compiled vars:  !0 = $x, !1 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
   20     1        NEW                                              $2      'Bar'
          2        SEND_VAL_EX                                              <false>
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $2
   21     5        INIT_DYNAMIC_CALL                                        !0
          6        SEND_VAR_EX                                              !1
          7        DO_FCALL                                      0          
   22     8        INIT_METHOD_CALL                                         !1, 'a'
          9        DO_FCALL                                      0  $6      
         10      > RETURN                                                   $6
   23    11*     > RETURN                                                   null

End of function foo

Function %00%7Bclosure%7D%2Fin%2FgYklr%3A25%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gYklr
function name:  {closure}
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   FETCH_THIS                                       $0      
          1        ASSIGN_OBJ                                               $0, 'a'
          2        OP_DATA                                                  <true>
          3      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FgYklr%3A25%240

Class Bar:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gYklr
function name:  __construct
number of ops:  5
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        BOOL                                             ~2      !0
          2        ASSIGN_OBJ                                               'a'
          3        OP_DATA                                                  ~2
   10     4      > RETURN                                                   null

End of function __construct

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

End of function a

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.19 ms | 1400 KiB | 15 Q