3v4l.org

run code in 300+ PHP versions simultaneously
<?php class FakeStringIntTuple { private $data = []; public function returnsCallable() { return $this; } public function __invoke(string $a, int $b) { $this->data[] = [$a, $b]; return $this; } } $tuple = (new FakeStringIntTuple())('foo', 123); var_dump($tuple); $tuple = new FakeStringIntTuple(); $tuple->returnsCallable()('bar', 456); var_dump($tuple); $tuple = (new FakeStringIntTuple()) ('foo', 123) ('bar', 456) ('baz', 789); var_dump($tuple);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3mAJV
function name:  (null)
number of ops:  41
compiled vars:  !0 = $tuple
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $1      'FakeStringIntTuple'
          1        DO_FCALL                                      0          
          2        INIT_DYNAMIC_CALL                                        $1
          3        SEND_VAL_EX                                              'foo'
          4        SEND_VAL_EX                                              123
          5        DO_FCALL                                      0  $3      
          6        ASSIGN                                                   !0, $3
   17     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
   19    10        NEW                                              $6      'FakeStringIntTuple'
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !0, $6
   20    13        INIT_METHOD_CALL                                         !0, 'returnsCallable'
         14        DO_FCALL                                      0  $9      
         15        INIT_DYNAMIC_CALL                                        $9
         16        SEND_VAL_EX                                              'bar'
         17        SEND_VAL_EX                                              456
         18        DO_FCALL                                      0          
   21    19        INIT_FCALL                                               'var_dump'
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                                 
   23    22        NEW                                              $12     'FakeStringIntTuple'
         23        DO_FCALL                                      0          
         24        INIT_DYNAMIC_CALL                                        $12
   24    25        SEND_VAL_EX                                              'foo'
         26        SEND_VAL_EX                                              123
         27        DO_FCALL                                      0  $14     
         28        INIT_DYNAMIC_CALL                                        $14
   25    29        SEND_VAL_EX                                              'bar'
         30        SEND_VAL_EX                                              456
         31        DO_FCALL                                      0  $15     
         32        INIT_DYNAMIC_CALL                                        $15
   26    33        SEND_VAL_EX                                              'baz'
         34        SEND_VAL_EX                                              789
         35        DO_FCALL                                      0  $16     
   23    36        ASSIGN                                                   !0, $16
   27    37        INIT_FCALL                                               'var_dump'
         38        SEND_VAR                                                 !0
         39        DO_ICALL                                                 
         40      > RETURN                                                   1

Class FakeStringIntTuple:
Function returnscallable:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3mAJV
function name:  returnsCallable
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_THIS                                       ~0      
          1      > RETURN                                                   ~0
    8     2*     > RETURN                                                   null

End of function returnscallable

Function __invoke:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3mAJV
function name:  __invoke
number of ops:  10
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        INIT_ARRAY                                       ~4      !0
          3        ADD_ARRAY_ELEMENT                                ~4      !1
          4        FETCH_OBJ_W                                      $2      'data'
          5        ASSIGN_DIM                                               $2
          6        OP_DATA                                                  ~4
   12     7        FETCH_THIS                                       ~5      
          8      > RETURN                                                   ~5
   13     9*     > RETURN                                                   null

End of function __invoke

End of class FakeStringIntTuple.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.83 ms | 1456 KiB | 14 Q