3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str1 = '布局 1 介绍 布局,简单来说就是设置元素的大小和位置。 Ext 的布局系统包括组件,布局,容器,容器是一种特殊的组件,可以管理组件的大小和位置。 容器是通过 doLayout 来重新计算布局,并更新 DOM. 2 手工布局是不必要的,框架会为你自动处理。'; $str2 = '!@#$%^&*()QWERTYUIOPSDFGHJKL!@#$%^&*()QWERTYUIOPSDFGHJKL:ZXCVBNMa!@#$%^&*()ERTYUIODFGHJKLXCVBNM@#$%^&*()RTYUIOPD:ZXCVBNM#!@#!@#$%^&*()QWERTYUIOPSDFGHJKL:ZXCVBNM-!@#$%^&*()ERTYUIODFGHJKLXCVBNM@#$%^&*()RTYUIOPD$%^&*()ERTYUIODFGHJ!@#$%^&*()QWERTYUIOPSDFGHJKL:ZXCVBNM]!@#$%^&*()ERTYUIODFGHJKLXCVBNM@#$%^&*()RTYUIOPDKLXCVBNM@#$%^&*()RTYUIOPDFGHJKLCVBNMFGHJTYU%^&RFGHJ4d56g7h8ui7h8ujirqwerqh8'; 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/K2XAf
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, '%E5%B8%83%E5%B1%80+1+%E4%BB%8B%E7%BB%8D+%E5%B8%83%E5%B1%80%EF%BC%8C%E7%AE%80%E5%8D%95%E6%9D%A5%E8%AF%B4%E5%B0%B1%E6%98%AF%E8%AE%BE%E7%BD%AE%E5%85%83%E7%B4%A0%E7%9A%84%E5%A4%A7%E5%B0%8F%E5%92%8C%E4%BD%8D%E7%BD%AE%E3%80%82+Ext+%E7%9A%84%E5%B8%83%E5%B1%80%E7%B3%BB%E7%BB%9F%E5%8C%85%E6%8B%AC%E7%BB%84%E4%BB%B6%EF%BC%8C%E5%B8%83%E5%B1%80%EF%BC%8C%E5%AE%B9%E5%99%A8%EF%BC%8C%E5%AE%B9%E5%99%A8%E6%98%AF%E4%B8%80%E7%A7%8D%E7%89%B9%E6%AE%8A%E7%9A%84%E7%BB%84%E4%BB%B6%EF%BC%8C%E5%8F%AF%E4%BB%A5%E7%AE%A1%E7%90%86%E7%BB%84%E4%BB%B6%E7%9A%84%E5%A4%A7%E5%B0%8F%E5%92%8C%E4%BD%8D%E7%BD%AE%E3%80%82+%E5%AE%B9%E5%99%A8%E6%98%AF%E9%80%9A%E8%BF%87+doLayout+%E6%9D%A5%E9%87%8D%E6%96%B0%E8%AE%A1%E7%AE%97%E5%B8%83%E5%B1%80%EF%BC%8C%E5%B9%B6%E6%9B%B4%E6%96%B0+DOM.+2+%E6%89%8B%E5%B7%A5%E5%B8%83%E5%B1%80%E6%98%AF%E4%B8%8D%E5%BF%85%E8%A6%81%E7%9A%84%EF%BC%8C%E6%A1%86%E6%9E%B6%E4%BC%9A%E4%B8%BA%E4%BD%A0%E8%87%AA%E5%8A%A8%E5%A4%84%E7%90%86%E3%80%82'
   3     1        ASSIGN                                                   !1, '%21%40%23%24%25%5E%26%2A%28%29QWERTYUIOPSDFGHJKL%21%40%23%24%25%5E%26%2A%28%29QWERTYUIOPSDFGHJKL%3AZXCVBNMa%21%40%23%24%25%5E%26%2A%28%29ERTYUIODFGHJKLXCVBNM%40%23%24%25%5E%26%2A%28%29RTYUIOPD%3AZXCVBNM%23%21%40%23%21%40%23%24%25%5E%26%2A%28%29QWERTYUIOPSDFGHJKL%3AZXCVBNM-%21%40%23%24%25%5E%26%2A%28%29ERTYUIODFGHJKLXCVBNM%40%23%24%25%5E%26%2A%28%29RTYUIOPD%24%25%5E%26%2A%28%29ERTYUIODFGHJ%21%40%23%24%25%5E%26%2A%28%29QWERTYUIOPSDFGHJKL%3AZXCVBNM%5D%21%40%23%24%25%5E%26%2A%28%29ERTYUIODFGHJKLXCVBNM%40%23%24%25%5E%26%2A%28%29RTYUIOPDKLXCVBNM%40%23%24%25%5E%26%2A%28%29RTYUIOPDFGHJKLCVBNMFGHJTYU%25%5E%26RFGHJ4d56g7h8ui7h8ujirqwerqh8'
   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 = 41
Branch analysis from position: 41
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 11
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 16
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 11
Branch analysis from position: 43
Branch analysis from position: 11
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 16
Branch analysis from position: 26
Branch analysis from position: 16
filename:       /in/K2XAf
function name:  compress_comp
number of ops:  44
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                                                      ->41
  16    11    >   INIT_FCALL_BY_NAME                                       'get_microtime'
        12        DO_FCALL                                      0  $15     
        13        ASSIGN                                                   !5, $15
  17    14        ASSIGN                                                   !6, 0
        15      > JMP                                                      ->24
  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        POST_INC                                         ~21     !6
        23        FREE                                                     ~21
        24    >   IS_SMALLER_OR_EQUAL                              ~22     !6, !1
        25      > JMPNZ                                                    ~22, ->16
  34    26    >   INIT_FCALL_BY_NAME                                       'get_microtime'
        27        DO_FCALL                                      0  $23     
        28        ASSIGN                                                   !8, $23
  35    29        FETCH_DIM_R                                      ~25     !2, !3
        30        CONCAT                                           ~26     ~25, '+%E5%8E%8B%E7%BC%A9%E5%90%8E%E5%A4%A7%E5%B0%8F%3A'
        31        STRLEN                                           ~27     !7
        32        CONCAT                                           ~28     ~26, ~27
        33        CONCAT                                           ~29     ~28, '+%E8%80%97%E6%97%B6%3A'
        34        SUB                                              ~30     !8, !5
        35        CONCAT                                           ~31     ~29, ~30
        36        CONCAT                                           ~32     ~31, 'ms'
        37        ECHO                                                     ~32
        38        ECHO                                                     '%0A'
  15    39        POST_INC                                         ~33     !3
        40        FREE                                                     ~33
        41    >   IS_SMALLER_OR_EQUAL                              ~34     !3, !4
        42      > JMPNZ                                                    ~34, ->11
  37    43    > > 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/K2XAf
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 7.4.0