3v4l.org

run code in 500+ PHP versions simultaneously
<?php $str1 = '{"seq":1,"app_id":"567067343352427","app_ver":"26.0.0.10.86","build_num":"83827592","device_id":"28de00f9-64ff-466c-89bb-ca25b5896613","family_device_id":"28de00f9-64ff-466c-89bb-ca25b5896613","session_id":"f97c8348-b785-43b6-a318-3d0fa6a2a2b9","uid":"0","config_checksum":"41da2f124d3b089eab730386564c4361","config_version":"v2","channel":"regular","log_type":"client_event","data":[{"name":"ig_account_switched","time":"1521488145.589","extra":{"from_pk":"7149962663","to_pk":"1415622097","entry_point":"long_press_tab_bar","pk":"7149962663","release_channel":"beta","radio_type":"mobile-lte"}}]}'; $str2 = '{"seq":1,"app_id":"567067343352427","app_ver":"26.0.0.10.86","build_num":"83827592","device_id":"28de00f9-64ff-466c-89bb-ca25b5896613","family_device_id":"28de00f9-64ff-466c-89bb-ca25b5896613","session_id":"f97c8348-b785-43b6-a318-3d0fa6a2a2b9","uid":"0","config_checksum":"41da2f124d3b089eab730386564c4361","config_version":"v2","channel":"regular","log_type":"client_event","data":[{"name":"ig_account_switched","time":"1521488145.589","extra":{"from_pk":"7149962663","to_pk":"1415622097","entry_point":"long_press_tab_bar","pk":"7149962663","release_channel":"beta","radio_type":"mobile-lte"}}]}'; echo '<b>压缩中文比较</b>',PHP_EOL,PHP_EOL; compress_comp( $str1, 1000 ); // 压缩1000次 与 解压缩1000次比较 echo PHP_EOL; echo '<b>压缩英文数字比较</b>',PHP_EOL,PHP_EOL; compress_comp( $str2, 1000 ); // 压缩1000次 与 解压缩1000次比较 /* 压缩 */ function compress_comp( $str, $num ) { $func_compress = array( 'gzcompress', 'gzencode', 'gzdeflate', 'bzcompress' ); //echo '原文:' . $str ,PHP_EOL; echo '原文大小:' . strlen( $str ) ,PHP_EOL; for ( $i = 0, $length = count( $func_compress ); $i < $length; $i ++ ) { $starttime = get_microtime(); for ( $j = 0; $j < $num; $j ++ ) { $mstr = $func_compress[ $i ]( $str, 6 ); /*switch ( $func_compress[ $i ] ) { case 'gzcompress': $mstr = gzcompress( $str, 9 ); // 解压方法:gzuncompress break; case 'gzencode': $mstr = gzencode( $str, 9 ); // 解压方法:gzdecode php>=5.4 break; case 'gzdeflate': $mstr = gzdeflate( $str, 9 ); // 解压方法:gzinflate break; case 'bzcompress': $mstr = bzcompress( $str, 9 ); // 解压方法:bzdecompress break; }*/ } $endtime = get_microtime(); echo $func_compress[ $i ] . ' 压缩后大小:' . strlen( $mstr ) . ' 耗时:' . ($endtime - $starttime ) . 'ms',PHP_EOL; } } /* 获取 microtime */ function get_microtime() { return microtime( true ); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cX4La
function name:  (null)
number of ops:  18
compiled vars:  !0 = $str1, !1 = $str2
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, '%7B%22seq%22%3A1%2C%22app_id%22%3A%22567067343352427%22%2C%22app_ver%22%3A%2226.0.0.10.86%22%2C%22build_num%22%3A%2283827592%22%2C%22device_id%22%3A%2228de00f9-64ff-466c-89bb-ca25b5896613%22%2C%22family_device_id%22%3A%2228de00f9-64ff-466c-89bb-ca25b5896613%22%2C%22session_id%22%3A%22f97c8348-b785-43b6-a318-3d0fa6a2a2b9%22%2C%22uid%22%3A%220%22%2C%22config_checksum%22%3A%2241da2f124d3b089eab730386564c4361%22%2C%22config_version%22%3A%22v2%22%2C%22channel%22%3A%22regular%22%2C%22log_type%22%3A%22client_event%22%2C%22data%22%3A%5B%7B%22name%22%3A%22ig_account_switched%22%2C%22time%22%3A%221521488145.589%22%2C%22extra%22%3A%7B%22from_pk%22%3A%227149962663%22%2C%22to_pk%22%3A%221415622097%22%2C%22entry_point%22%3A%22long_press_tab_bar%22%2C%22pk%22%3A%227149962663%22%2C%22release_channel%22%3A%22beta%22%2C%22radio_type%22%3A%22mobile-lte%22%7D%7D%5D%7D'
    3     1        ASSIGN                                                       !1, '%7B%22seq%22%3A1%2C%22app_id%22%3A%22567067343352427%22%2C%22app_ver%22%3A%2226.0.0.10.86%22%2C%22build_num%22%3A%2283827592%22%2C%22device_id%22%3A%2228de00f9-64ff-466c-89bb-ca25b5896613%22%2C%22family_device_id%22%3A%2228de00f9-64ff-466c-89bb-ca25b5896613%22%2C%22session_id%22%3A%22f97c8348-b785-43b6-a318-3d0fa6a2a2b9%22%2C%22uid%22%3A%220%22%2C%22config_checksum%22%3A%2241da2f124d3b089eab730386564c4361%22%2C%22config_version%22%3A%22v2%22%2C%22channel%22%3A%22regular%22%2C%22log_type%22%3A%22client_event%22%2C%22data%22%3A%5B%7B%22name%22%3A%22ig_account_switched%22%2C%22time%22%3A%221521488145.589%22%2C%22extra%22%3A%7B%22from_pk%22%3A%227149962663%22%2C%22to_pk%22%3A%221415622097%22%2C%22entry_point%22%3A%22long_press_tab_bar%22%2C%22pk%22%3A%227149962663%22%2C%22release_channel%22%3A%22beta%22%2C%22radio_type%22%3A%22mobile-lte%22%7D%7D%5D%7D'
    4     2        ECHO                                                         '%3Cb%3E%E5%8E%8B%E7%BC%A9%E4%B8%AD%E6%96%87%E6%AF%94%E8%BE%83%3C%2Fb%3E'
          3        ECHO                                                         '%0A'
          4        ECHO                                                         '%0A'
    5     5        INIT_FCALL_BY_NAME                                           'compress_comp'
          6        SEND_VAR_EX                                                  !0
          7        SEND_VAL_EX                                                  1000
          8        DO_FCALL                                          0          
    6     9        ECHO                                                         '%0A'
    7    10        ECHO                                                         '%3Cb%3E%E5%8E%8B%E7%BC%A9%E8%8B%B1%E6%96%87%E6%95%B0%E5%AD%97%E6%AF%94%E8%BE%83%3C%2Fb%3E'
         11        ECHO                                                         '%0A'
         12        ECHO                                                         '%0A'
    8    13        INIT_FCALL_BY_NAME                                           'compress_comp'
         14        SEND_VAR_EX                                                  !1
         15        SEND_VAL_EX                                                  1000
         16        DO_FCALL                                          0          
   43    17      > RETURN                                                       1

Function compress_comp:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 11
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 16
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 11
Branch analysis from position: 41
Branch analysis from position: 11
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 16
Branch analysis from position: 25
Branch analysis from position: 16
filename:       /in/cX4La
function name:  compress_comp
number of ops:  42
compiled vars:  !0 = $str, !1 = $num, !2 = $func_compress, !3 = $i, !4 = $length, !5 = $starttime, !6 = $j, !7 = $mstr, !8 = $endtime
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   12     2        ASSIGN                                                       !2, <array>
   14     3        STRLEN                                               ~10     !0
          4        CONCAT                                               ~11     '%E5%8E%9F%E6%96%87%E5%A4%A7%E5%B0%8F%3A', ~10
          5        ECHO                                                         ~11
          6        ECHO                                                         '%0A'
   15     7        ASSIGN                                                       !3, 0
          8        COUNT                                                ~13     !2
          9        ASSIGN                                                       !4, ~13
         10      > JMP                                                          ->39
   16    11    >   INIT_FCALL_BY_NAME                                           'get_microtime'
         12        DO_FCALL                                          0  $15     
         13        ASSIGN                                                       !5, $15
   17    14        ASSIGN                                                       !6, 0
         15      > JMP                                                          ->23
   18    16    >   FETCH_DIM_R                                          ~18     !2, !3
         17        INIT_DYNAMIC_CALL                                            ~18
         18        SEND_VAR_EX                                                  !0
         19        SEND_VAL_EX                                                  6
         20        DO_FCALL                                          0  $19     
         21        ASSIGN                                                       !7, $19
   17    22        PRE_INC                                                      !6
         23    >   IS_SMALLER                                                   !6, !1
         24      > JMPNZ                                                        ~22, ->16
   34    25    >   INIT_FCALL_BY_NAME                                           'get_microtime'
         26        DO_FCALL                                          0  $23     
         27        ASSIGN                                                       !8, $23
   35    28        FETCH_DIM_R                                          ~25     !2, !3
         29        CONCAT                                               ~26     ~25, '+%E5%8E%8B%E7%BC%A9%E5%90%8E%E5%A4%A7%E5%B0%8F%3A'
         30        STRLEN                                               ~27     !7
         31        CONCAT                                               ~28     ~26, ~27
         32        CONCAT                                               ~29     ~28, '+%E8%80%97%E6%97%B6%3A'
         33        SUB                                                  ~30     !8, !5
         34        CONCAT                                               ~31     ~29, ~30
         35        CONCAT                                               ~32     ~31, 'ms'
         36        ECHO                                                         ~32
         37        ECHO                                                         '%0A'
   15    38        PRE_INC                                                      !3
         39    >   IS_SMALLER                                                   !3, !4
         40      > JMPNZ                                                        ~34, ->11
   37    41    > > RETURN                                                       null

End of function compress_comp

Function get_microtime:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cX4La
function name:  get_microtime
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   42     0  E >   INIT_FCALL                                                   'microtime'
          1        SEND_VAL                                                     <true>
          2        DO_ICALL                                             $0      
          3      > RETURN                                                       $0
   43     4*     > RETURN                                                       null

End of function get_microtime

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
162.51 ms | 1391 KiB | 14 Q