3v4l.org

run code in 300+ PHP versions simultaneously
<?php function init_vera_htmlspecialchars() { if (version_compare(PHP_VERSION, '5.4.0') >= 0) { define('V_ENT_COMPAT_HTML401',ENT_COMPAT | ENT_HTML401); function vera_htmlspecialchars($string, $flags = V_ENT_COMPAT_HTML401 , $encoding = 'ISO-8869-2', $doubleEncode = true) { return htmlspecialchars($string, $flags, $encoding, $doubleEncode); } } elseif (version_compare(PHP_VERSION, '5.2.3') >= 0) { function vera_htmlspecialchars($string, $flags = ENT_COMPAT, $encoding = 'ISO-8869-2', $doubleEncode = true) { return htmlspecialchars($string, $flags, $encoding, $doubleEncode); } } else { function vera_htmlspecialchars($string, $flags = ENT_COMPAT, $encoding = 'ISO-8869-2', $doubleEncode = true) { return htmlspecialchars($string, $flags, $encoding); } } }; init_vera_htmlspecialchars(); $start = microtime(true); for ($i=0; $i<1000000; $i++) { $str = htmlspecialchars('asdf&<>;\'"',ENT_QUOTES,'UTF-8'); } echo $str . "\n"; $middle = microtime(true); for ($i=0; $i<1000000; $i++) { $str = vera_htmlspecialchars('asdf&<>;\'"',ENT_QUOTES,'UTF-8'); } echo $str . "\n"; $end = microtime(true); echo ($middle-$start) . "\n"; echo ($end - $middle) . "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 8
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 25
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 25
Branch analysis from position: 34
Branch analysis from position: 25
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 8
Branch analysis from position: 17
Branch analysis from position: 8
filename:       /in/O6bfn
function name:  (null)
number of ops:  47
compiled vars:  !0 = $start, !1 = $i, !2 = $str, !3 = $middle, !4 = $end
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   INIT_FCALL                                               'init_vera_htmlspecialchars'
          1        DO_FCALL                                      0          
   24     2        INIT_FCALL                                               'microtime'
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $6      
          5        ASSIGN                                                   !0, $6
   25     6        ASSIGN                                                   !1, 0
          7      > JMP                                                      ->15
   26     8    >   INIT_FCALL                                               'htmlspecialchars'
          9        SEND_VAL                                                 'asdf%26%3C%3E%3B%27%22'
         10        SEND_VAL                                                 3
         11        SEND_VAL                                                 'UTF-8'
         12        DO_ICALL                                         $9      
         13        ASSIGN                                                   !2, $9
   25    14        PRE_INC                                                  !1
         15    >   IS_SMALLER                                               !1, 1000000
         16      > JMPNZ                                                    ~12, ->8
   28    17    >   CONCAT                                           ~13     !2, '%0A'
         18        ECHO                                                     ~13
   29    19        INIT_FCALL                                               'microtime'
         20        SEND_VAL                                                 <true>
         21        DO_ICALL                                         $14     
         22        ASSIGN                                                   !3, $14
   30    23        ASSIGN                                                   !1, 0
         24      > JMP                                                      ->32
   31    25    >   INIT_FCALL_BY_NAME                                       'vera_htmlspecialchars'
         26        SEND_VAL_EX                                              'asdf%26%3C%3E%3B%27%22'
         27        SEND_VAL_EX                                              3
         28        SEND_VAL_EX                                              'UTF-8'
         29        DO_FCALL                                      0  $17     
         30        ASSIGN                                                   !2, $17
   30    31        PRE_INC                                                  !1
         32    >   IS_SMALLER                                               !1, 1000000
         33      > JMPNZ                                                    ~20, ->25
   33    34    >   CONCAT                                           ~21     !2, '%0A'
         35        ECHO                                                     ~21
   34    36        INIT_FCALL                                               'microtime'
         37        SEND_VAL                                                 <true>
         38        DO_ICALL                                         $22     
         39        ASSIGN                                                   !4, $22
   36    40        SUB                                              ~24     !3, !0
         41        CONCAT                                           ~25     ~24, '%0A'
         42        ECHO                                                     ~25
   37    43        SUB                                              ~26     !4, !3
         44        CONCAT                                           ~27     ~26, '%0A'
         45        ECHO                                                     ~27
         46      > RETURN                                                   1

Function init_vera_htmlspecialchars:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 12
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/O6bfn
function name:  init_vera_htmlspecialchars
number of ops:  22
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   INIT_FCALL                                               'version_compare'
          1        SEND_VAL                                                 '8.0.0'
          2        SEND_VAL                                                 '5.4.0'
          3        DO_ICALL                                         $0      
          4        IS_SMALLER_OR_EQUAL                                      0, $0
          5      > JMPZ                                                     ~1, ->12
    7     6    >   INIT_FCALL                                               'define'
          7        SEND_VAL                                                 'V_ENT_COMPAT_HTML401'
          8        SEND_VAL                                                 2
          9        DO_ICALL                                                 
    8    10        DECLARE_FUNCTION                                         'vera_htmlspecialchars'
   10    11      > JMP                                                      ->21
   11    12    >   INIT_FCALL                                               'version_compare'
         13        SEND_VAL                                                 '8.0.0'
         14        SEND_VAL                                                 '5.2.3'
         15        DO_ICALL                                         $3      
         16        IS_SMALLER_OR_EQUAL                                      0, $3
         17      > JMPZ                                                     ~4, ->20
   12    18    >   DECLARE_FUNCTION                                         'vera_htmlspecialchars'
   14    19      > JMP                                                      ->21
   16    20    >   DECLARE_FUNCTION                                         'vera_htmlspecialchars'
   21    21    > > RETURN                                                   null

End of function init_vera_htmlspecialchars

Function %00vera_htmlspecialchars%2Fin%2FO6bfn%3A8%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/O6bfn
function name:  vera_htmlspecialchars
number of ops:  12
compiled vars:  !0 = $string, !1 = $flags, !2 = $encoding, !3 = $doubleEncode
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <const ast>
          2        RECV_INIT                                        !2      'ISO-8869-2'
          3        RECV_INIT                                        !3      <true>
    9     4        INIT_FCALL                                               'htmlspecialchars'
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !1
          7        SEND_VAR                                                 !2
          8        SEND_VAR                                                 !3
          9        DO_ICALL                                         $4      
         10      > RETURN                                                   $4
   10    11*     > RETURN                                                   null

End of function %00vera_htmlspecialchars%2Fin%2FO6bfn%3A8%240

Function %00vera_htmlspecialchars%2Fin%2FO6bfn%3A12%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/O6bfn
function name:  vera_htmlspecialchars
number of ops:  12
compiled vars:  !0 = $string, !1 = $flags, !2 = $encoding, !3 = $doubleEncode
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <const ast>
          2        RECV_INIT                                        !2      'ISO-8869-2'
          3        RECV_INIT                                        !3      <true>
   13     4        INIT_FCALL                                               'htmlspecialchars'
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !1
          7        SEND_VAR                                                 !2
          8        SEND_VAR                                                 !3
          9        DO_ICALL                                         $4      
         10      > RETURN                                                   $4
   14    11*     > RETURN                                                   null

End of function %00vera_htmlspecialchars%2Fin%2FO6bfn%3A12%241

Function %00vera_htmlspecialchars%2Fin%2FO6bfn%3A16%242:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/O6bfn
function name:  vera_htmlspecialchars
number of ops:  11
compiled vars:  !0 = $string, !1 = $flags, !2 = $encoding, !3 = $doubleEncode
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <const ast>
          2        RECV_INIT                                        !2      'ISO-8869-2'
          3        RECV_INIT                                        !3      <true>
   17     4        INIT_FCALL                                               'htmlspecialchars'
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !1
          7        SEND_VAR                                                 !2
          8        DO_ICALL                                         $4      
          9      > RETURN                                                   $4
   18    10*     > RETURN                                                   null

End of function %00vera_htmlspecialchars%2Fin%2FO6bfn%3A16%242

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.66 ms | 1411 KiB | 22 Q