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; } } (new FakeStringIntTuple())('foo', 123); $a = new FakeStringIntTuple(); $a->returnsCallable()('bar', 456); $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/4N9if
function name:  (null)
number of ops:  34
compiled vars:  !0 = $a, !1 = $tuple
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $2      'FakeStringIntTuple'
          1        DO_FCALL                                      0          
          2        INIT_DYNAMIC_CALL                                        $2
          3        SEND_VAL_EX                                              'foo'
          4        SEND_VAL_EX                                              123
          5        DO_FCALL                                      0          
   18     6        NEW                                              $5      'FakeStringIntTuple'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !0, $5
   19     9        INIT_METHOD_CALL                                         !0, 'returnsCallable'
         10        DO_FCALL                                      0  $8      
         11        INIT_DYNAMIC_CALL                                        $8
         12        SEND_VAL_EX                                              'bar'
         13        SEND_VAL_EX                                              456
         14        DO_FCALL                                      0          
   21    15        NEW                                              $10     'FakeStringIntTuple'
         16        DO_FCALL                                      0          
         17        INIT_DYNAMIC_CALL                                        $10
   22    18        SEND_VAL_EX                                              'foo'
         19        SEND_VAL_EX                                              123
         20        DO_FCALL                                      0  $12     
         21        INIT_DYNAMIC_CALL                                        $12
   23    22        SEND_VAL_EX                                              'bar'
         23        SEND_VAL_EX                                              456
         24        DO_FCALL                                      0  $13     
         25        INIT_DYNAMIC_CALL                                        $13
   24    26        SEND_VAL_EX                                              'baz'
         27        SEND_VAL_EX                                              789
         28        DO_FCALL                                      0  $14     
   21    29        ASSIGN                                                   !1, $14
   25    30        INIT_FCALL                                               'var_dump'
         31        SEND_VAR                                                 !1
         32        DO_ICALL                                                 
         33      > RETURN                                                   1

Class FakeStringIntTuple:
Function returnscallable:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4N9if
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/4N9if
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:
158.3 ms | 1400 KiB | 15 Q