3v4l.org

run code in 300+ PHP versions simultaneously
<?php function xrange($start, $limit, $step = 1) { for ($i = $start; $i <= $limit; $i += $step) { yield $i; } } $time = microtime(true); $first = implode(' ', range(1,1000, 2)); $time1 = microtime(true); $second = implode(' ', xrange(1, 1000, 2)); $time2 = microtime(true); var_dump($time2- $time1, $time1 - $time);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DTJtB
function name:  (null)
number of ops:  39
compiled vars:  !0 = $time, !1 = $first, !2 = $time1, !3 = $second, !4 = $time2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'microtime'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                         $5      
          3        ASSIGN                                                   !0, $5
    8     4        INIT_FCALL                                               'implode'
          5        SEND_VAL                                                 '+'
          6        INIT_FCALL                                               'range'
          7        SEND_VAL                                                 1
          8        SEND_VAL                                                 1000
          9        SEND_VAL                                                 2
         10        DO_ICALL                                         $7      
         11        SEND_VAR                                                 $7
         12        DO_ICALL                                         $8      
         13        ASSIGN                                                   !1, $8
   10    14        INIT_FCALL                                               'microtime'
         15        SEND_VAL                                                 <true>
         16        DO_ICALL                                         $10     
         17        ASSIGN                                                   !2, $10
   11    18        INIT_FCALL                                               'implode'
         19        SEND_VAL                                                 '+'
         20        INIT_FCALL                                               'xrange'
         21        SEND_VAL                                                 1
         22        SEND_VAL                                                 1000
         23        SEND_VAL                                                 2
         24        DO_FCALL                                      0  $12     
         25        SEND_VAR                                                 $12
         26        DO_ICALL                                         $13     
         27        ASSIGN                                                   !3, $13
   13    28        INIT_FCALL                                               'microtime'
         29        SEND_VAL                                                 <true>
         30        DO_ICALL                                         $15     
         31        ASSIGN                                                   !4, $15
   15    32        INIT_FCALL                                               'var_dump'
         33        SUB                                              ~17     !4, !2
         34        SEND_VAL                                                 ~17
         35        SUB                                              ~18     !2, !0
         36        SEND_VAL                                                 ~18
         37        DO_ICALL                                                 
         38      > RETURN                                                   1

Function xrange:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 6
Branch analysis from position: 10
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 6
Branch analysis from position: 10
Branch analysis from position: 6
filename:       /in/DTJtB
function name:  xrange
number of ops:  11
compiled vars:  !0 = $start, !1 = $limit, !2 = $step, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      1
          3        GENERATOR_CREATE                                         
    3     4        ASSIGN                                                   !3, !0
          5      > JMP                                                      ->8
    4     6    >   YIELD                                                    !3
    3     7        ASSIGN_OP                                     1          !3, !2
          8    >   IS_SMALLER_OR_EQUAL                                      !3, !1
          9      > JMPNZ                                                    ~7, ->6
    6    10    > > GENERATOR_RETURN                                         

End of function xrange

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.2 ms | 1407 KiB | 22 Q