3v4l.org

run code in 300+ PHP versions simultaneously
<?php class one { private $var; public function __construct() { $this->var = array(); } public function saveIteration($a) { $this->var[] = $a; return $this->var; } public function getVar() { return $this->var; } } $one = new one(); $time_start = microtime(true); for ($i = 0; $i < 10000; $i++) { $res = $one->saveIteration($i); } echo "First took " . number_format(microtime(true) - $time_start, 3) . " sec.\n"; //reset unset($one);$one = new one(); $time_start = microtime(true); for ($i = 0; $i < 10000; $i++) { $one->saveIteration($i); } $res = $one->getVar(); echo "Second took " . number_format(microtime(true) - $time_start, 3) . " sec.";

Abusive script

This script was stopped while abusing our resources

Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 9
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 37
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 37
Branch analysis from position: 43
Branch analysis from position: 37
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 9
Branch analysis from position: 16
Branch analysis from position: 9
filename:       /in/XCBuY
function name:  (null)
number of ops:  58
compiled vars:  !0 = $one, !1 = $time_start, !2 = $i, !3 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $4      'one'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
   21     3        INIT_FCALL                                               'microtime'
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $7      
          6        ASSIGN                                                   !1, $7
   23     7        ASSIGN                                                   !2, 0
          8      > JMP                                                      ->14
   24     9    >   INIT_METHOD_CALL                                         !0, 'saveIteration'
         10        SEND_VAR_EX                                              !2
         11        DO_FCALL                                      0  $10     
         12        ASSIGN                                                   !3, $10
   23    13        PRE_INC                                                  !2
         14    >   IS_SMALLER                                               !2, 10000
         15      > JMPNZ                                                    ~13, ->9
   26    16    >   INIT_FCALL                                               'number_format'
         17        INIT_FCALL                                               'microtime'
         18        SEND_VAL                                                 <true>
         19        DO_ICALL                                         $14     
         20        SUB                                              ~15     $14, !1
         21        SEND_VAL                                                 ~15
         22        SEND_VAL                                                 3
         23        DO_ICALL                                         $16     
         24        CONCAT                                           ~17     'First+took+', $16
         25        CONCAT                                           ~18     ~17, '+sec.%0A'
         26        ECHO                                                     ~18
   29    27        UNSET_CV                                                 !0
         28        NEW                                              $19     'one'
         29        DO_FCALL                                      0          
         30        ASSIGN                                                   !0, $19
   30    31        INIT_FCALL                                               'microtime'
         32        SEND_VAL                                                 <true>
         33        DO_ICALL                                         $22     
         34        ASSIGN                                                   !1, $22
   32    35        ASSIGN                                                   !2, 0
         36      > JMP                                                      ->41
   33    37    >   INIT_METHOD_CALL                                         !0, 'saveIteration'
         38        SEND_VAR_EX                                              !2
         39        DO_FCALL                                      0          
   32    40        PRE_INC                                                  !2
         41    >   IS_SMALLER                                               !2, 10000
         42      > JMPNZ                                                    ~27, ->37
   36    43    >   INIT_METHOD_CALL                                         !0, 'getVar'
         44        DO_FCALL                                      0  $28     
         45        ASSIGN                                                   !3, $28
   37    46        INIT_FCALL                                               'number_format'
         47        INIT_FCALL                                               'microtime'
         48        SEND_VAL                                                 <true>
         49        DO_ICALL                                         $30     
         50        SUB                                              ~31     $30, !1
         51        SEND_VAL                                                 ~31
         52        SEND_VAL                                                 3
         53        DO_ICALL                                         $32     
         54        CONCAT                                           ~33     'Second+took+', $32
         55        CONCAT                                           ~34     ~33, '+sec.'
         56        ECHO                                                     ~34
         57      > RETURN                                                   1

Class one:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XCBuY
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN_OBJ                                               'var'
          1        OP_DATA                                                  <array>
    8     2      > RETURN                                                   null

End of function __construct

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

End of function saveiteration

Function getvar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XCBuY
function name:  getVar
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   FETCH_OBJ_R                                      ~0      'var'
          1      > RETURN                                                   ~0
   17     2*     > RETURN                                                   null

End of function getvar

End of class one.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.22 ms | 1010 KiB | 15 Q