3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string='sadfsakfjbsadjkfhsadkjfhasdlkjhfksahjksdhfkjasdhflkjashfkjshadkfjhsakldfjhsakf'; $time=microtime(true); for($i=0;$i<1000;$i++) removeaccents1($string); $time=mictotime(true)-$time; echo "New took $time seconds\n"; $time=microtime(true); for($i=0;$i<1000;$i++) removeaccents2($string); $time=mictotime(true)-$time; echo "Old took $time seconds\n"; function removeaccents1($string) { return utf8_encode(strtr(utf8_decode($string),utf8_decode('ŠŒŽšœžŸ¥µÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ'),'SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy')); } function removeaccents2($string) { return strtr($string,'ŠŒŽšœžŸ¥µÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ','SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy'); }
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 = 7
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 28
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 28
Branch analysis from position: 34
Branch analysis from position: 28
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 7
Branch analysis from position: 13
Branch analysis from position: 7
filename:       /in/b88N4
function name:  (null)
number of ops:  44
compiled vars:  !0 = $string, !1 = $time, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'sadfsakfjbsadjkfhsadkjfhasdlkjhfksahjksdhfkjasdhflkjashfkjshadkfjhsakldfjhsakf'
    3     1        INIT_FCALL                                               'microtime'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !1, $4
    4     5        ASSIGN                                                   !2, 0
          6      > JMP                                                      ->11
    5     7    >   INIT_FCALL_BY_NAME                                       'removeaccents1'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0          
    4    10        PRE_INC                                                  !2
         11    >   IS_SMALLER                                               !2, 1000
         12      > JMPNZ                                                    ~9, ->7
    6    13    >   INIT_FCALL_BY_NAME                                       'mictotime'
         14        SEND_VAL_EX                                              <true>
         15        DO_FCALL                                      0  $10     
         16        SUB                                              ~11     $10, !1
         17        ASSIGN                                                   !1, ~11
    7    18        ROPE_INIT                                     3  ~14     'New+took+'
         19        ROPE_ADD                                      1  ~14     ~14, !1
         20        ROPE_END                                      2  ~13     ~14, '+seconds%0A'
         21        ECHO                                                     ~13
    9    22        INIT_FCALL                                               'microtime'
         23        SEND_VAL                                                 <true>
         24        DO_ICALL                                         $16     
         25        ASSIGN                                                   !1, $16
   10    26        ASSIGN                                                   !2, 0
         27      > JMP                                                      ->32
   11    28    >   INIT_FCALL_BY_NAME                                       'removeaccents2'
         29        SEND_VAR_EX                                              !0
         30        DO_FCALL                                      0          
   10    31        PRE_INC                                                  !2
         32    >   IS_SMALLER                                               !2, 1000
         33      > JMPNZ                                                    ~21, ->28
   12    34    >   INIT_FCALL_BY_NAME                                       'mictotime'
         35        SEND_VAL_EX                                              <true>
         36        DO_FCALL                                      0  $22     
         37        SUB                                              ~23     $22, !1
         38        ASSIGN                                                   !1, ~23
   13    39        ROPE_INIT                                     3  ~26     'Old+took+'
         40        ROPE_ADD                                      1  ~26     ~26, !1
         41        ROPE_END                                      2  ~25     ~26, '+seconds%0A'
         42        ECHO                                                     ~25
   23    43      > RETURN                                                   1

Function removeaccents1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b88N4
function name:  removeaccents1
number of ops:  17
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   17     1        INIT_FCALL                                               'utf8_encode'
          2        INIT_FCALL                                               'strtr'
          3        INIT_FCALL                                               'utf8_decode'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $1      
          6        SEND_VAR                                                 $1
          7        INIT_FCALL                                               'utf8_decode'
          8        SEND_VAL                                                 '%C5%A0%C5%92%C5%BD%C5%A1%C5%93%C5%BE%C5%B8%C2%A5%C2%B5%C3%80%C3%81%C3%82%C3%83%C3%84%C3%85%C3%86%C3%87%C3%88%C3%89%C3%8A%C3%8B%C3%8C%C3%8D%C3%8E%C3%8F%C3%90%C3%91%C3%92%C3%93%C3%94%C3%95%C3%96%C3%98%C3%99%C3%9A%C3%9B%C3%9C%C3%9D%C3%9F%C3%A0%C3%A1%C3%A2%C3%A3%C3%A4%C3%A5%C3%A6%C3%A7%C3%A8%C3%A9%C3%AA%C3%AB%C3%AC%C3%AD%C3%AE%C3%AF%C3%B0%C3%B1%C3%B2%C3%B3%C3%B4%C3%B5%C3%B6%C3%B8%C3%B9%C3%BA%C3%BB%C3%BC%C3%BD%C3%BF'
          9        DO_ICALL                                         $2      
         10        SEND_VAR                                                 $2
         11        SEND_VAL                                                 'SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy'
         12        DO_ICALL                                         $3      
         13        SEND_VAR                                                 $3
         14        DO_ICALL                                         $4      
         15      > RETURN                                                   $4
   18    16*     > RETURN                                                   null

End of function removeaccents1

Function removeaccents2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b88N4
function name:  removeaccents2
number of ops:  8
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   22     1        INIT_FCALL                                               'strtr'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '%C5%A0%C5%92%C5%BD%C5%A1%C5%93%C5%BE%C5%B8%C2%A5%C2%B5%C3%80%C3%81%C3%82%C3%83%C3%84%C3%85%C3%86%C3%87%C3%88%C3%89%C3%8A%C3%8B%C3%8C%C3%8D%C3%8E%C3%8F%C3%90%C3%91%C3%92%C3%93%C3%94%C3%95%C3%96%C3%98%C3%99%C3%9A%C3%9B%C3%9C%C3%9D%C3%9F%C3%A0%C3%A1%C3%A2%C3%A3%C3%A4%C3%A5%C3%A6%C3%A7%C3%A8%C3%A9%C3%AA%C3%AB%C3%AC%C3%AD%C3%AE%C3%AF%C3%B0%C3%B1%C3%B2%C3%B3%C3%B4%C3%B5%C3%B6%C3%B8%C3%B9%C3%BA%C3%BB%C3%BC%C3%BD%C3%BF'
          4        SEND_VAL                                                 'SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy'
          5        DO_ICALL                                         $1      
          6      > RETURN                                                   $1
   23     7*     > RETURN                                                   null

End of function removeaccents2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.43 ms | 1404 KiB | 21 Q