3v4l.org

run code in 300+ PHP versions simultaneously
<?php class T { static $results=array(); static function insert( $number ) { //Inserts a number into the array array_push( self::$results, $number ); return new static; } static function add( $number ) { //Adds to the last inserted number self::$results[] = array_pop(self::$results) + $number; return new static; } static function results() { //Display results foreach(self::$results as $k=>$v) { echo "{$k} : {$v}<BR>\n"; } } } T::insert(4)-> add(2)-> insert(12)-> insert(2)-> add(1)-> results();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PETeB
function name:  (null)
number of ops:  18
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   INIT_STATIC_METHOD_CALL                                  'T', 'insert'
          1        SEND_VAL                                                 4
          2        DO_FCALL                                      0  $0      
   24     3        INIT_METHOD_CALL                                         $0, 'add'
          4        SEND_VAL_EX                                              2
          5        DO_FCALL                                      0  $1      
   25     6        INIT_METHOD_CALL                                         $1, 'insert'
          7        SEND_VAL_EX                                              12
          8        DO_FCALL                                      0  $2      
   26     9        INIT_METHOD_CALL                                         $2, 'insert'
         10        SEND_VAL_EX                                              2
         11        DO_FCALL                                      0  $3      
   27    12        INIT_METHOD_CALL                                         $3, 'add'
         13        SEND_VAL_EX                                              1
         14        DO_FCALL                                      0  $4      
   28    15        INIT_METHOD_CALL                                         $4, 'results'
         16        DO_FCALL                                      0          
         17      > RETURN                                                   1

Class T:
Function insert:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PETeB
function name:  insert
number of ops:  10
compiled vars:  !0 = $number
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        INIT_FCALL                                               'array_push'
          2        FETCH_STATIC_PROP_W          unknown             $1      'results'
          3        SEND_REF                                                 $1
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
    8     6        NEW                          static              $3      
          7        DO_FCALL                                      0          
          8      > RETURN                                                   $3
    9     9*     > RETURN                                                   null

End of function insert

Function add:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PETeB
function name:  add
number of ops:  13
compiled vars:  !0 = $number
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        INIT_FCALL                                               'array_pop'
          2        FETCH_STATIC_PROP_W          unknown             $3      'results'
          3        SEND_REF                                                 $3
          4        DO_ICALL                                         $4      
          5        ADD                                              ~5      $4, !0
          6        FETCH_STATIC_PROP_W          global              $1      'results'
          7        ASSIGN_DIM                                               $1
          8        OP_DATA                                                  ~5
   13     9        NEW                          static              $6      
         10        DO_FCALL                                      0          
         11      > RETURN                                                   $6
   14    12*     > RETURN                                                   null

End of function add

Function results:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 10
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/PETeB
function name:  results
number of ops:  12
compiled vars:  !0 = $v, !1 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   FETCH_STATIC_PROP_R          unknown             ~2      'results'
          1      > FE_RESET_R                                       $3      ~2, ->10
          2    > > FE_FETCH_R                                       ~4      $3, !0, ->10
          3    >   ASSIGN                                                   !1, ~4
   17     4        ROPE_INIT                                     4  ~7      !1
          5        ROPE_ADD                                      1  ~7      ~7, '+%3A+'
          6        ROPE_ADD                                      2  ~7      ~7, !0
          7        ROPE_END                                      3  ~6      ~7, '%3CBR%3E%0A'
          8        ECHO                                                     ~6
   16     9      > JMP                                                      ->2
         10    >   FE_FREE                                                  $3
   19    11      > RETURN                                                   null

End of function results

End of class T.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.91 ms | 1400 KiB | 17 Q