3v4l.org

run code in 300+ PHP versions simultaneously
<?php class NumberReturner { private $nums; public function __construct($nums) { $this->nums = $nums; } public function resolve() { return $this->nums; } } $objs = [new NumberReturner([1, 2, 3, 4]), new NumberReturner([1, 2, 5, 6]), new NumberReturner([1, 2, 6])]; $initial = array_shift($objs)->resolve(); $result = array_reduce($objs, function($result, $obj) { return array_intersect($result, $obj->resolve()); }, $initial); var_dump($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5dY7r
function name:  (null)
number of ops:  30
compiled vars:  !0 = $objs, !1 = $initial, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $3      'NumberReturner'
          1        SEND_VAL_EX                                              <array>
          2        DO_FCALL                                      0          
          3        INIT_ARRAY                                       ~5      $3
          4        NEW                                              $6      'NumberReturner'
          5        SEND_VAL_EX                                              <array>
          6        DO_FCALL                                      0          
          7        ADD_ARRAY_ELEMENT                                ~5      $6
          8        NEW                                              $8      'NumberReturner'
          9        SEND_VAL_EX                                              <array>
         10        DO_FCALL                                      0          
         11        ADD_ARRAY_ELEMENT                                ~5      $8
         12        ASSIGN                                                   !0, ~5
   20    13        INIT_FCALL                                               'array_shift'
         14        SEND_REF                                                 !0
         15        DO_ICALL                                         $11     
         16        INIT_METHOD_CALL                                         $11, 'resolve'
         17        DO_FCALL                                      0  $12     
         18        ASSIGN                                                   !1, $12
   21    19        INIT_FCALL                                               'array_reduce'
         20        SEND_VAR                                                 !0
         21        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F5dY7r%3A21%240'
   23    22        SEND_VAL                                                 ~14
         23        SEND_VAR                                                 !1
         24        DO_ICALL                                         $15     
   21    25        ASSIGN                                                   !2, $15
   25    26        INIT_FCALL                                               'var_dump'
         27        SEND_VAR                                                 !2
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F5dY7r%3A21%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5dY7r
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $result, !1 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   22     2        INIT_FCALL                                               'array_intersect'
          3        SEND_VAR                                                 !0
          4        INIT_METHOD_CALL                                         !1, 'resolve'
          5        DO_FCALL                                      0  $2      
          6        SEND_VAR                                                 $2
          7        DO_ICALL                                         $3      
          8      > RETURN                                                   $3
   23     9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F5dY7r%3A21%240

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

End of function __construct

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

End of function resolve

End of class NumberReturner.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.15 ms | 1400 KiB | 21 Q