3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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);
based on 4N9if
Finding entry points
Branch analysis from position: 0
Jump found. (Code = 62) Position 1 = -2
filename:       /in/3mAJV
function name:  (null)
number of ops:  42
compiled vars:  !0 = $tuple
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NOP                                                      
  16     1        NEW                                              $2      :-5
         2        DO_FCALL                                      0          
         3        INIT_DYNAMIC_CALL                                        $2
         4        SEND_VAL_EX                                              'foo'
         5        SEND_VAL_EX                                              123
         6        DO_FCALL                                      0  $4      
         7        ASSIGN                                                   !0, $4
  17     8        INIT_FCALL                                               'var_dump'
         9        SEND_VAR                                                 !0
        10        DO_ICALL                                                 
  19    11        NEW                                              $7      :0
        12        DO_FCALL                                      0          
        13        ASSIGN                                                   !0, $7
  20    14        INIT_METHOD_CALL                                         !0, 'returnsCallable'
        15        DO_FCALL                                      0  $10     
        16        INIT_DYNAMIC_CALL                                        $10
        17        SEND_VAL_EX                                              'bar'
        18        SEND_VAL_EX                                              456
        19        DO_FCALL                                      0          
  21    20        INIT_FCALL                                               'var_dump'
        21        SEND_VAR                                                 !0
        22        DO_ICALL                                                 
  23    23        NEW                                              $13     :7
        24        DO_FCALL                                      0          
        25        INIT_DYNAMIC_CALL                                        $13
  24    26        SEND_VAL_EX                                              'foo'
        27        SEND_VAL_EX                                              123
        28        DO_FCALL                                      0  $15     
        29        INIT_DYNAMIC_CALL                                        $15
  25    30        SEND_VAL_EX                                              'bar'
        31        SEND_VAL_EX                                              456
        32        DO_FCALL                                      0  $16     
        33        INIT_DYNAMIC_CALL                                        $16
  26    34        SEND_VAL_EX                                              'baz'
        35        SEND_VAL_EX                                              789
        36        DO_FCALL                                      0  $17     
        37        ASSIGN                                                   !0, $17
  27    38        INIT_FCALL                                               'var_dump'
        39        SEND_VAR                                                 !0
        40        DO_ICALL                                                 
        41      > RETURN                                                   1

Class FakeStringIntTuple:
Function returnscallable:
Finding entry points
Branch analysis from position: 0
Jump 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
Jump 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 7.1.0