3v4l.org

run code in 300+ PHP versions simultaneously
<?php class X { var $value; function get() { return null !== $this->value ? $this->value : ($this->value = $this->getLongCalculation()); } function getLongCalculation() { sleep(3); return 5; } } $x = new X; var_dump($x->get()); var_dump($x->get());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/erkvJ
function name:  (null)
number of ops:  14
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $1      'X'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   21     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'get'
          5        DO_FCALL                                      0  $4      
          6        SEND_VAR                                                 $4
          7        DO_ICALL                                                 
   22     8        INIT_FCALL                                               'var_dump'
          9        INIT_METHOD_CALL                                         !0, 'get'
         10        DO_FCALL                                      0  $6      
         11        SEND_VAR                                                 $6
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Class X:
Function get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/erkvJ
function name:  get
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   FETCH_OBJ_R                                      ~0      'value'
          1        TYPE_CHECK                                  1020          ~0
          2      > JMPZ                                                     ~1, ->6
          3    >   FETCH_OBJ_R                                      ~2      'value'
          4        QM_ASSIGN                                        ~3      ~2
          5      > JMP                                                      ->11
          6    >   INIT_METHOD_CALL                                         'getLongCalculation'
          7        DO_FCALL                                      0  $5      
          8        ASSIGN_OBJ                                       ~4      'value'
          9        OP_DATA                                                  $5
         10        QM_ASSIGN                                        ~3      ~4
         11    > > RETURN                                                   ~3
    9    12*     > RETURN                                                   null

End of function get

Function getlongcalculation:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/erkvJ
function name:  getLongCalculation
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'sleep'
          1        SEND_VAL                                                 3
          2        DO_ICALL                                                 
   16     3      > RETURN                                                   5
   17     4*     > RETURN                                                   null

End of function getlongcalculation

End of class X.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.19 ms | 1396 KiB | 17 Q