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; } }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.32, 8.2.0 - 8.2.28, 8.3.0 - 8.3.22, 8.4.1 - 8.4.8
Parse error: Unclosed '{' on line 11 in /in/vKYOU on line 36
Process exited with code 255.
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Parse error: syntax error, unexpected end of file in /in/vKYOU on line 36
Process exited with code 255.

preferences:
65.8 ms | 1895 KiB | 3 Q