3v4l.org

run code in 300+ PHP versions simultaneously
<?php $isset = true; $array = array(); $notSetArray = array(0=>''); $string = ''; // Test Source function TestEmpty() { $array = array(); unset($array); $i = 0; /* The Test */ $t = microtime(true); while($i < 2000) { empty($arrday); ++$i; } echo (microtime(true) - $t); } function TestEmpty2() { $array = array(); unset($array); $i = 0; /* The Test */ $t = microtime(true); while($i < 2000) { ($array == []); ++$i; } echo (microtime(true) - $t); } function TestEmpty3() { $array = array(); unset($array); $i = 0; /* The Test */ $t = microtime(true); while($i < 2000) { ($array === []); ++$i; } echo (microtime(true) - $t); } TestEmpty(); echo '<hr>-----'; TestEmpty2(); echo '<hr>-----'; TestEmpty3();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4TI2R
function name:  (null)
number of ops:  13
compiled vars:  !0 = $isset, !1 = $array, !2 = $notSetArray, !3 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <true>
    4     1        ASSIGN                                                   !1, <array>
    5     2        ASSIGN                                                   !2, <array>
    6     3        ASSIGN                                                   !3, ''
   54     4        INIT_FCALL                                               'testempty'
          5        DO_FCALL                                      0          
   55     6        ECHO                                                     '%3Chr%3E-----'
   56     7        INIT_FCALL                                               'testempty2'
          8        DO_FCALL                                      0          
   57     9        ECHO                                                     '%3Chr%3E-----'
   58    10        INIT_FCALL                                               'testempty3'
         11        DO_FCALL                                      0          
         12      > RETURN                                                   1

Function testempty:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 8
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 8
Branch analysis from position: 13
Branch analysis from position: 8
filename:       /in/4TI2R
function name:  TestEmpty
number of ops:  19
compiled vars:  !0 = $array, !1 = $i, !2 = $t, !3 = $arrday
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, <array>
   11     1        UNSET_CV                                                 !0
   13     2        ASSIGN                                                   !1, 0
   15     3        INIT_FCALL                                               'microtime'
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $6      
          6        ASSIGN                                                   !2, $6
   16     7      > JMP                                                      ->11
   17     8    >   ISSET_ISEMPTY_CV                                 ~8      !3
          9        FREE                                                     ~8
   18    10        PRE_INC                                                  !1
   16    11    >   IS_SMALLER                                               !1, 2000
         12      > JMPNZ                                                    ~10, ->8
   21    13    >   INIT_FCALL                                               'microtime'
         14        SEND_VAL                                                 <true>
         15        DO_ICALL                                         $11     
         16        SUB                                              ~12     $11, !2
         17        ECHO                                                     ~12
   22    18      > RETURN                                                   null

End of function testempty

Function testempty2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 8
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 8
Branch analysis from position: 13
Branch analysis from position: 8
filename:       /in/4TI2R
function name:  TestEmpty2
number of ops:  19
compiled vars:  !0 = $array, !1 = $i, !2 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   ASSIGN                                                   !0, <array>
   26     1        UNSET_CV                                                 !0
   27     2        ASSIGN                                                   !1, 0
   29     3        INIT_FCALL                                               'microtime'
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $5      
          6        ASSIGN                                                   !2, $5
   30     7      > JMP                                                      ->11
   31     8    >   IS_EQUAL                                         ~7      !0, <array>
          9        FREE                                                     ~7
   32    10        PRE_INC                                                  !1
   30    11    >   IS_SMALLER                                               !1, 2000
         12      > JMPNZ                                                    ~9, ->8
   35    13    >   INIT_FCALL                                               'microtime'
         14        SEND_VAL                                                 <true>
         15        DO_ICALL                                         $10     
         16        SUB                                              ~11     $10, !2
         17        ECHO                                                     ~11
   36    18      > RETURN                                                   null

End of function testempty2

Function testempty3:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 8
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 8
Branch analysis from position: 13
Branch analysis from position: 8
filename:       /in/4TI2R
function name:  TestEmpty3
number of ops:  19
compiled vars:  !0 = $array, !1 = $i, !2 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   ASSIGN                                                   !0, <array>
   41     1        UNSET_CV                                                 !0
   43     2        ASSIGN                                                   !1, 0
   45     3        INIT_FCALL                                               'microtime'
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $5      
          6        ASSIGN                                                   !2, $5
   46     7      > JMP                                                      ->11
   47     8    >   IS_IDENTICAL                                     ~7      !0, <array>
          9        FREE                                                     ~7
   48    10        PRE_INC                                                  !1
   46    11    >   IS_SMALLER                                               !1, 2000
         12      > JMPNZ                                                    ~9, ->8
   51    13    >   INIT_FCALL                                               'microtime'
         14        SEND_VAL                                                 <true>
         15        DO_ICALL                                         $10     
         16        SUB                                              ~11     $10, !2
         17        ECHO                                                     ~11
   52    18      > RETURN                                                   null

End of function testempty3

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.45 ms | 1398 KiB | 18 Q