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 ); }

Shows result from various feature-branches currently under review from the php developers. Contact me to have additional branches featured.

Output for branch master
<b>压缩中文比较</b> 原文大小:328 gzcompress 压缩后大小:251 耗时:0.031199932098389ms gzencode 压缩后大小:263 耗时:0.027292966842651ms gzdeflate 压缩后大小:245 耗时:0.02297306060791ms Fatal error: Uncaught Error: Call to undefined function bzcompress() in /in/K2XAf:18 Stack trace: #0 /in/K2XAf(5): compress_comp('\xE5\xB8\x83\xE5\xB1\x80 1 \xE4\xBB\x8B\xE7\xBB\x8D...', 1000) #1 {main} thrown in /in/K2XAf on line 18
Process exited with code 255.
Output for branch master_jit
<b>压缩中文比较</b> 原文大小:328 gzcompress 压缩后大小:251 耗时:0.043097019195557ms gzencode 压缩后大小:263 耗时:0.044100999832153ms gzdeflate 压缩后大小:245 耗时:0.036130905151367ms Fatal error: Uncaught Error: Call to undefined function bzcompress() in /in/K2XAf:18 Stack trace: #0 /in/K2XAf(5): compress_comp('\xE5\xB8\x83\xE5\xB1\x80 1 \xE4\xBB\x8B\xE7\xBB\x8D...', 1000) #1 {main} thrown in /in/K2XAf on line 18
Process exited with code 255.

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page