3v4l.org

run code in 300+ PHP versions simultaneously
<?php function str_contains_not( $show = '' ) { $url = true; if ( ! str_contains( $show, 'url' ) && ! str_contains( $show, 'directory' ) && ! str_contains( $show, 'home' ) ) { $url = false; } if ( $url ) {} } function str_contains_or( $show = '' ) { if ( str_contains( $show, 'url' ) || str_contains( $show, 'directory' ) || str_contains( $show, 'home' ) ) {} } $its = 1e3; $t = hrtime(true); for ( $i=0;$i++<$its;) $z = str_contains_not( 'blogname' ); echo (hrtime(true)-$t)/1e9,"s\n"; $t = hrtime(true); for ( $i=0;$i++<$its;) $z = str_contains_or( 'blogname' ); echo (hrtime(true)-$t)/1e9,"s\n"; echo "\n=== Warmed up ===\n\n"; $its = 1e5; $t = hrtime(true); for ( $i=0;$i++<$its;) $z = str_contains_not( 'blogname' ); echo 'str_contains_not: ', $a=(hrtime(true)-$t)/1e9,"s\n"; $t = hrtime(true); for ( $i=0;$i++<$its;) $z = str_contains_or( 'blogname' ); echo 'str_contains_or : ', $b=(hrtime(true)-$t)/1e9,"s\n"; echo 'str_contains_or is ', number_format((($a-$b)/$a) * 100, 2 ), "% faster than str_contains_not\n";
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 = 14, Position 2 = 7
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 27
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
2 jumps found. (Code = 44) Position 1 = 56, Position 2 = 49
Branch analysis from position: 56
1 jumps found. (Code = 42) Position 1 = 75
Branch analysis from position: 75
2 jumps found. (Code = 44) Position 1 = 78, Position 2 = 71
Branch analysis from position: 78
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 71
2 jumps found. (Code = 44) Position 1 = 78, Position 2 = 71
Branch analysis from position: 78
Branch analysis from position: 71
Branch analysis from position: 49
2 jumps found. (Code = 44) Position 1 = 56, Position 2 = 49
Branch analysis from position: 56
Branch analysis from position: 49
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 27
Branch analysis from position: 34
Branch analysis from position: 27
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 7
Branch analysis from position: 14
Branch analysis from position: 7
filename:       /in/8hSiW
function name:  (null)
number of ops:  98
compiled vars:  !0 = $its, !1 = $t, !2 = $i, !3 = $z, !4 = $a, !5 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   ASSIGN                                                   !0, 1000
   23     1        INIT_FCALL                                               'hrtime'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $7      
          4        ASSIGN                                                   !1, $7
   24     5        ASSIGN                                                   !2, 0
          6      > JMP                                                      ->11
   25     7    >   INIT_FCALL                                               'str_contains_not'
          8        SEND_VAL                                                 'blogname'
          9        DO_FCALL                                      0  $10     
         10        ASSIGN                                                   !3, $10
   24    11    >   POST_INC                                         ~12     !2
         12        IS_SMALLER                                               ~12, !0
         13      > JMPNZ                                                    ~13, ->7
   26    14    >   INIT_FCALL                                               'hrtime'
         15        SEND_VAL                                                 <true>
         16        DO_ICALL                                         $14     
         17        SUB                                              ~15     $14, !1
         18        DIV                                              ~16     ~15, 1.0e+9
         19        ECHO                                                     ~16
         20        ECHO                                                     's%0A'
   28    21        INIT_FCALL                                               'hrtime'
         22        SEND_VAL                                                 <true>
         23        DO_ICALL                                         $17     
         24        ASSIGN                                                   !1, $17
   29    25        ASSIGN                                                   !2, 0
         26      > JMP                                                      ->31
   30    27    >   INIT_FCALL                                               'str_contains_or'
         28        SEND_VAL                                                 'blogname'
         29        DO_FCALL                                      0  $20     
         30        ASSIGN                                                   !3, $20
   29    31    >   POST_INC                                         ~22     !2
         32        IS_SMALLER                                               ~22, !0
         33      > JMPNZ                                                    ~23, ->27
   31    34    >   INIT_FCALL                                               'hrtime'
         35        SEND_VAL                                                 <true>
         36        DO_ICALL                                         $24     
         37        SUB                                              ~25     $24, !1
         38        DIV                                              ~26     ~25, 1.0e+9
         39        ECHO                                                     ~26
         40        ECHO                                                     's%0A'
   33    41        ECHO                                                     '%0A%3D%3D%3D+Warmed+up+%3D%3D%3D%0A%0A'
   35    42        ASSIGN                                                   !0, 100000
   37    43        INIT_FCALL                                               'hrtime'
         44        SEND_VAL                                                 <true>
         45        DO_ICALL                                         $28     
         46        ASSIGN                                                   !1, $28
   38    47        ASSIGN                                                   !2, 0
         48      > JMP                                                      ->53
   39    49    >   INIT_FCALL                                               'str_contains_not'
         50        SEND_VAL                                                 'blogname'
         51        DO_FCALL                                      0  $31     
         52        ASSIGN                                                   !3, $31
   38    53    >   POST_INC                                         ~33     !2
         54        IS_SMALLER                                               ~33, !0
         55      > JMPNZ                                                    ~34, ->49
   40    56    >   ECHO                                                     'str_contains_not%3A+'
         57        INIT_FCALL                                               'hrtime'
         58        SEND_VAL                                                 <true>
         59        DO_ICALL                                         $35     
         60        SUB                                              ~36     $35, !1
         61        DIV                                              ~37     ~36, 1.0e+9
         62        ASSIGN                                           ~38     !4, ~37
         63        ECHO                                                     ~38
         64        ECHO                                                     's%0A'
   42    65        INIT_FCALL                                               'hrtime'
         66        SEND_VAL                                                 <true>
         67        DO_ICALL                                         $39     
         68        ASSIGN                                                   !1, $39
   43    69        ASSIGN                                                   !2, 0
         70      > JMP                                                      ->75
   44    71    >   INIT_FCALL                                               'str_contains_or'
         72        SEND_VAL                                                 'blogname'
         73        DO_FCALL                                      0  $42     
         74        ASSIGN                                                   !3, $42
   43    75    >   POST_INC                                         ~44     !2
         76        IS_SMALLER                                               ~44, !0
         77      > JMPNZ                                                    ~45, ->71
   45    78    >   ECHO                                                     'str_contains_or+%3A+'
         79        INIT_FCALL                                               'hrtime'
         80        SEND_VAL                                                 <true>
         81        DO_ICALL                                         $46     
         82        SUB                                              ~47     $46, !1
         83        DIV                                              ~48     ~47, 1.0e+9
         84        ASSIGN                                           ~49     !5, ~48
         85        ECHO                                                     ~49
         86        ECHO                                                     's%0A'
   47    87        ECHO                                                     'str_contains_or+is+'
         88        INIT_FCALL                                               'number_format'
         89        SUB                                              ~50     !4, !5
         90        DIV                                              ~51     ~50, !4
         91        MUL                                              ~52     ~51, 100
         92        SEND_VAL                                                 ~52
         93        SEND_VAL                                                 2
         94        DO_ICALL                                         $53     
         95        ECHO                                                     $53
         96        ECHO                                                     '%25+faster+than+str_contains_not%0A'
         97      > RETURN                                                   1

Function str_contains_not:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 8, Position 2 = 14
Branch analysis from position: 8
2 jumps found. (Code = 46) Position 1 = 15, Position 2 = 21
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 23
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 24
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
Branch analysis from position: 23
Branch analysis from position: 21
Branch analysis from position: 14
filename:       /in/8hSiW
function name:  str_contains_not
number of ops:  25
compiled vars:  !0 = $show, !1 = $url
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV_INIT                                        !0      ''
    4     1        ASSIGN                                                   !1, <true>
    6     2        INIT_FCALL                                               'str_contains'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'url'
          5        DO_ICALL                                         $3      
          6        BOOL_NOT                                         ~4      $3
          7      > JMPZ_EX                                          ~4      ~4, ->14
    7     8    >   INIT_FCALL                                               'str_contains'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 'directory'
         11        DO_ICALL                                         $5      
         12        BOOL_NOT                                         ~6      $5
         13        BOOL                                             ~4      ~6
         14    > > JMPZ_EX                                          ~4      ~4, ->21
    8    15    >   INIT_FCALL                                               'str_contains'
         16        SEND_VAR                                                 !0
         17        SEND_VAL                                                 'home'
         18        DO_ICALL                                         $7      
         19        BOOL_NOT                                         ~8      $7
         20        BOOL                                             ~4      ~8
         21    > > JMPZ                                                     ~4, ->23
   10    22    >   ASSIGN                                                   !1, <false>
   13    23    > > JMPZ                                                     !1, ->24
   14    24    > > RETURN                                                   null

End of function str_contains_not

Function str_contains_or:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
2 jumps found. (Code = 47) Position 1 = 12, Position 2 = 17
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 18
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
Branch analysis from position: 17
Branch analysis from position: 11
filename:       /in/8hSiW
function name:  str_contains_or
number of ops:  19
compiled vars:  !0 = $show
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV_INIT                                        !0      ''
   16     1        INIT_FCALL                                               'str_contains'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'url'
          4        DO_ICALL                                         $1      
          5      > JMPNZ_EX                                         ~2      $1, ->11
   17     6    >   INIT_FCALL                                               'str_contains'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 'directory'
          9        DO_ICALL                                         $3      
         10        BOOL                                             ~2      $3
         11    > > JMPNZ_EX                                         ~2      ~2, ->17
   18    12    >   INIT_FCALL                                               'str_contains'
         13        SEND_VAR                                                 !0
         14        SEND_VAL                                                 'home'
         15        DO_ICALL                                         $4      
         16        BOOL                                             ~2      $4
         17    > > JMPZ                                                     ~2, ->18
   19    18    > > RETURN                                                   null

End of function str_contains_or

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.78 ms | 970 KiB | 20 Q