3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = array( ' hello ','whsdf ',' lve you',' '); $input2 = array( ' hello ','whsdf ',' lve you',' '); $input3 = array( ' hello ','whsdf ',' lve you',' '); $time_start = microtime(true); $input = array_map('trim',$input); $time_end = microtime(true); $time = $time_end - $time_start; echo "Did array_map in $time seconds<br>"; foreach($input as $in){ echo "'$in': ".strlen($in)."<br>"; } //////////////////////////////////////////////// $time_start = microtime(true); array_walk($input2,'trim'); $time_end = microtime(true); $time = $time_end - $time_start; echo "Did array_walk in $time seconds<br>"; foreach($input2 as $in){ echo "'$in': ".strlen($in)."<br>"; } //////////////////////////////////////////////// $time_start = microtime(true); foreach($input3 as $in){ $in = trim($in); } $time_end = microtime(true); $time = $time_end - $time_start; echo "Did foreach in $time seconds<br>"; foreach($input3 as $in){ echo "'$in': ".strlen($in)."<br>"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 23, Position 2 = 32
Branch analysis from position: 23
2 jumps found. (Code = 78) Position 1 = 24, Position 2 = 32
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
Branch analysis from position: 32
2 jumps found. (Code = 77) Position 1 = 52, Position 2 = 61
Branch analysis from position: 52
2 jumps found. (Code = 78) Position 1 = 53, Position 2 = 61
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 52
Branch analysis from position: 52
Branch analysis from position: 61
2 jumps found. (Code = 77) Position 1 = 67, Position 2 = 73
Branch analysis from position: 67
2 jumps found. (Code = 78) Position 1 = 68, Position 2 = 73
Branch analysis from position: 68
1 jumps found. (Code = 42) Position 1 = 67
Branch analysis from position: 67
Branch analysis from position: 73
2 jumps found. (Code = 77) Position 1 = 85, Position 2 = 94
Branch analysis from position: 85
2 jumps found. (Code = 78) Position 1 = 86, Position 2 = 94
Branch analysis from position: 86
1 jumps found. (Code = 42) Position 1 = 85
Branch analysis from position: 85
Branch analysis from position: 94
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 94
Branch analysis from position: 73
Branch analysis from position: 61
Branch analysis from position: 32
filename:       /in/Dd70P
function name:  (null)
number of ops:  96
compiled vars:  !0 = $input, !1 = $input2, !2 = $input3, !3 = $time_start, !4 = $time_end, !5 = $time, !6 = $in
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, <array>
    4     2        ASSIGN                                                   !2, <array>
    6     3        INIT_FCALL                                               'microtime'
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $10     
          6        ASSIGN                                                   !3, $10
    7     7        INIT_FCALL                                               'array_map'
          8        SEND_VAL                                                 'trim'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $12     
         11        ASSIGN                                                   !0, $12
    8    12        INIT_FCALL                                               'microtime'
         13        SEND_VAL                                                 <true>
         14        DO_ICALL                                         $14     
         15        ASSIGN                                                   !4, $14
    9    16        SUB                                              ~16     !4, !3
         17        ASSIGN                                                   !5, ~16
   11    18        ROPE_INIT                                     3  ~19     'Did+array_map+in+'
         19        ROPE_ADD                                      1  ~19     ~19, !5
         20        ROPE_END                                      2  ~18     ~19, '+seconds%3Cbr%3E'
         21        ECHO                                                     ~18
   13    22      > FE_RESET_R                                       $21     !0, ->32
         23    > > FE_FETCH_R                                               $21, !6, ->32
   14    24    >   ROPE_INIT                                     3  ~23     '%27'
         25        ROPE_ADD                                      1  ~23     ~23, !6
         26        ROPE_END                                      2  ~22     ~23, '%27%3A+'
         27        STRLEN                                           ~25     !6
         28        CONCAT                                           ~26     ~22, ~25
         29        CONCAT                                           ~27     ~26, '%3Cbr%3E'
         30        ECHO                                                     ~27
   13    31      > JMP                                                      ->23
         32    >   FE_FREE                                                  $21
   19    33        INIT_FCALL                                               'microtime'
         34        SEND_VAL                                                 <true>
         35        DO_ICALL                                         $28     
         36        ASSIGN                                                   !3, $28
   20    37        INIT_FCALL                                               'array_walk'
         38        SEND_REF                                                 !1
         39        SEND_VAL                                                 'trim'
         40        DO_ICALL                                                 
   21    41        INIT_FCALL                                               'microtime'
         42        SEND_VAL                                                 <true>
         43        DO_ICALL                                         $31     
         44        ASSIGN                                                   !4, $31
   22    45        SUB                                              ~33     !4, !3
         46        ASSIGN                                                   !5, ~33
   24    47        ROPE_INIT                                     3  ~36     'Did+array_walk+in+'
         48        ROPE_ADD                                      1  ~36     ~36, !5
         49        ROPE_END                                      2  ~35     ~36, '+seconds%3Cbr%3E'
         50        ECHO                                                     ~35
   26    51      > FE_RESET_R                                       $38     !1, ->61
         52    > > FE_FETCH_R                                               $38, !6, ->61
   27    53    >   ROPE_INIT                                     3  ~40     '%27'
         54        ROPE_ADD                                      1  ~40     ~40, !6
         55        ROPE_END                                      2  ~39     ~40, '%27%3A+'
         56        STRLEN                                           ~42     !6
         57        CONCAT                                           ~43     ~39, ~42
         58        CONCAT                                           ~44     ~43, '%3Cbr%3E'
         59        ECHO                                                     ~44
   26    60      > JMP                                                      ->52
         61    >   FE_FREE                                                  $38
   33    62        INIT_FCALL                                               'microtime'
         63        SEND_VAL                                                 <true>
         64        DO_ICALL                                         $45     
         65        ASSIGN                                                   !3, $45
   34    66      > FE_RESET_R                                       $47     !2, ->73
         67    > > FE_FETCH_R                                               $47, !6, ->73
   35    68    >   INIT_FCALL                                               'trim'
         69        SEND_VAR                                                 !6
         70        DO_ICALL                                         $48     
         71        ASSIGN                                                   !6, $48
   34    72      > JMP                                                      ->67
         73    >   FE_FREE                                                  $47
   37    74        INIT_FCALL                                               'microtime'
         75        SEND_VAL                                                 <true>
         76        DO_ICALL                                         $50     
         77        ASSIGN                                                   !4, $50
   38    78        SUB                                              ~52     !4, !3
         79        ASSIGN                                                   !5, ~52
   40    80        ROPE_INIT                                     3  ~55     'Did+foreach+in+'
         81        ROPE_ADD                                      1  ~55     ~55, !5
         82        ROPE_END                                      2  ~54     ~55, '+seconds%3Cbr%3E'
         83        ECHO                                                     ~54
   42    84      > FE_RESET_R                                       $57     !2, ->94
         85    > > FE_FETCH_R                                               $57, !6, ->94
   43    86    >   ROPE_INIT                                     3  ~59     '%27'
         87        ROPE_ADD                                      1  ~59     ~59, !6
         88        ROPE_END                                      2  ~58     ~59, '%27%3A+'
         89        STRLEN                                           ~61     !6
         90        CONCAT                                           ~62     ~58, ~61
         91        CONCAT                                           ~63     ~62, '%3Cbr%3E'
         92        ECHO                                                     ~63
   42    93      > JMP                                                      ->85
         94    >   FE_FREE                                                  $57
   44    95      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.45 ms | 1404 KiB | 21 Q