3v4l.org

run code in 300+ PHP versions simultaneously
<?php function dateWord($from, $now) { $timezone = new DateTimeZone('Asia/Shanghai'); $now = new DateTime($now, $timezone); $from = new DateTime($from, $timezone); $between = $now->diff($from); if(!$between->invert) return false; /** 如果超过了一年 **/ if($between->y) return $from->format('Y年m月d日'); /** 一年内大于七天 **/ if($between->days > 6) return $from->format('n月j日'); /** 一个礼拜内但是大于两天**/ if($between->days > 1) return $between->format('%d天前'); /** 如果是昨天 **/ if($between->days) return $from->format('昨天 H:i'); /** 如果一天之内超过一个小时 **/ if($between->h > 1) return $between->format('%h小时前'); if($between->i > 1) return $between->format('%i分钟前'); return $between->s ? $between->format('%s秒前') : '刚刚'; } function dateWordToHtml($from, $now = 'now') { echo $dateWord = dateWord($from, $now); $from = new DateTime($from, new DateTimeZone('Asia/Shanghai')); $fromWord = $from->format('Y年m月d日 H:i'); return "<span title=\"$fromWord\">$dateWord</span>"; } //dateWord()函数对应的是Typecho原版的返回,dateWordToHtml()函数则是对应你修改的那个函数 echo dateWordToHtml("2014/4/14 9:32");

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.60.0000.01518.55
8.3.50.0110.00722.19
8.3.40.0120.00318.73
8.3.30.0030.01019.09
8.3.20.0070.00020.21
8.3.10.0040.00422.05
8.3.00.0040.00422.49
8.2.180.0040.01117.00
8.2.170.0090.00622.96
8.2.160.0040.01120.90
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0080.00826.16
8.2.120.0060.00317.63
8.2.110.0090.00022.12
8.2.100.0130.00019.76
8.2.90.0000.00719.35
8.2.80.0030.00617.97
8.2.70.0030.00617.75
8.2.60.0080.00017.93
8.2.50.0030.00518.07
8.2.40.0000.00818.27
8.2.30.0000.00718.14
8.2.20.0000.00817.88
8.2.10.0040.00417.90
8.2.00.0000.00717.90
8.1.270.0090.00022.20
8.1.260.0090.00026.35
8.1.250.0000.00828.09
8.1.240.0090.00024.03
8.1.230.0060.00619.14
8.1.220.0030.00517.74
8.1.210.0040.00418.77
8.1.200.0000.01017.48
8.1.190.0030.00517.53
8.1.180.0070.00418.10
8.1.170.0040.00418.75
8.1.160.0000.00921.91
8.1.150.0030.00518.76
8.1.140.0000.00717.58
8.1.130.0000.00817.83
8.1.120.0040.00417.56
8.1.110.0000.00817.72
8.1.100.0040.00417.68
8.1.90.0000.00717.64
8.1.80.0000.00717.55
8.1.70.0040.00417.53
8.1.60.0060.00317.57
8.1.50.0080.00017.57
8.1.40.0070.00317.65
8.1.30.0000.00817.80
8.1.20.0000.00817.67
8.1.10.0040.00417.72
8.1.00.0040.00417.64
8.0.300.0040.00418.77
8.0.290.0070.00017.30
8.0.280.0000.00718.59
8.0.270.0050.00217.39
8.0.260.0030.00317.03
8.0.250.0070.00017.21
8.0.240.0040.00417.01
8.0.230.0030.00317.16
8.0.220.0030.00317.12
8.0.210.0030.00317.14
8.0.200.0000.00717.18
8.0.190.0040.00417.21
8.0.180.0070.00017.16
8.0.170.0040.00417.00
8.0.160.0040.00417.13
8.0.150.0090.00017.17
8.0.140.0000.00717.00
8.0.130.0030.00313.50
8.0.120.0000.00817.01
8.0.110.0040.00417.02
8.0.100.0070.00017.07
8.0.90.0070.00017.01
8.0.80.0060.01017.16
8.0.70.0000.00816.99
8.0.60.0000.00716.90
8.0.50.0070.00017.01
8.0.30.0030.01517.13
8.0.20.0110.00917.40
8.0.10.0040.00417.20
8.0.00.0100.00816.89
7.4.330.0050.00015.08
7.4.320.0030.00316.70
7.4.300.0030.00316.66
7.4.290.0070.00016.73
7.4.280.0030.00616.79
7.4.270.0000.00716.59
7.4.260.0000.00716.54
7.4.250.0020.00516.64
7.4.240.0020.00516.69
7.4.230.0000.00716.56
7.4.220.0070.01116.74
7.4.210.0100.00716.82
7.4.200.0030.00316.56
7.4.190.0030.00316.70
7.4.160.0060.01116.70
7.4.150.0040.01417.40
7.4.140.0100.00817.86
7.4.130.0090.01016.70
7.4.120.0120.00916.78
7.4.110.0100.00716.76
7.4.100.0070.01016.54
7.4.90.0090.00916.76
7.4.80.0060.01219.39
7.4.70.0050.01116.70
7.4.60.0110.00616.87
7.4.50.0000.00916.84
7.4.40.0060.01022.77
7.4.30.0080.00816.82
7.4.00.0030.01015.02
7.3.330.0000.00613.45
7.3.320.0050.00013.45
7.3.310.0040.00416.46
7.3.300.0060.00016.39
7.3.290.0040.01116.38
7.3.280.0080.01116.44
7.3.270.0070.01017.40
7.3.260.0150.00616.63
7.3.250.0150.00516.63
7.3.240.0070.01116.70
7.3.230.0080.00816.61
7.3.210.0080.00816.57
7.3.200.0130.00319.39
7.3.190.0080.00816.50
7.3.180.0100.00716.75
7.3.170.0150.00316.77
7.3.160.0060.01016.80
7.3.120.0070.00714.78
7.2.330.0100.00716.70
7.2.320.0060.01216.66
7.2.310.0070.01016.83
7.2.300.0060.01016.95
7.2.290.0060.01616.66
7.2.60.0000.01517.02
7.2.00.0060.00619.16
7.1.200.0100.00016.04
7.1.100.0000.01818.12
7.1.70.0000.01017.43
7.1.60.0090.01519.82
7.1.50.0100.01017.23
7.1.00.0030.07722.45
7.0.200.0090.00915.08
7.0.140.0070.07022.08
7.0.60.0070.03719.86
7.0.50.0070.08018.00
7.0.40.0100.08319.96
7.0.30.0330.07720.25
7.0.20.0300.03720.08
7.0.10.0300.04320.21
7.0.00.0100.04720.16
5.6.280.0030.07321.08
5.6.210.0170.05320.48
5.6.200.0030.06018.16
5.6.190.0100.08320.77
5.6.180.3800.04720.67
5.6.170.0270.04720.64
5.6.160.0100.06320.56
5.6.150.0030.08718.16
5.6.140.0030.09018.17
5.6.130.0030.05718.15
5.6.120.0100.06320.91
5.6.110.0300.05721.00
5.6.100.0100.08021.00
5.6.90.0170.06021.00
5.6.80.0070.05720.49
5.6.70.0300.07020.55
5.5.350.0030.06020.36
5.5.340.0070.03717.99
5.5.330.0070.04320.27
5.5.320.0230.05020.24
5.5.310.0130.04720.35
5.5.300.0070.08317.96
5.5.290.0200.06717.98
5.5.280.0070.08020.82
5.5.270.0130.08020.87
5.5.260.0130.07720.78
5.5.250.0100.08020.51
5.5.240.0130.07020.08
5.4.450.0100.03719.33
5.4.440.0430.04319.49
5.4.430.0370.04319.15
5.4.420.0400.03019.53
5.4.410.0270.04019.20
5.4.400.0100.05318.77
5.4.390.0070.05718.61
5.4.380.0330.05018.77
5.4.370.0200.04718.71
5.4.360.0100.05718.60
5.4.350.0130.05318.65
5.4.340.0100.06018.62
5.4.320.0080.03512.52
5.4.310.0050.03912.52
5.4.300.0040.03812.52
5.4.290.0060.03812.52
5.4.280.0050.03512.41
5.4.270.0170.05018.87
5.4.260.0330.05318.75
5.4.250.0130.08018.72
5.4.240.0170.06718.98
5.4.230.0200.05718.82
5.4.220.0130.05018.82
5.4.210.0230.04718.95
5.4.200.0100.07018.96
5.4.190.0130.07318.95
5.4.180.0100.06718.93
5.4.170.0100.07718.82
5.4.160.0130.05318.80
5.4.150.0100.07718.82
5.4.140.0230.05316.46
5.4.130.0070.05316.68
5.4.120.0200.04316.67
5.4.110.0200.04716.68
5.4.100.0170.06316.53
5.4.90.0130.06316.47
5.4.80.0130.04316.63
5.4.70.0170.04016.66
5.4.60.0070.05316.66
5.4.50.0130.06016.64
5.4.40.0130.05716.44
5.4.30.0100.06016.63
5.4.20.0070.05316.66
5.4.10.0200.06716.62
5.4.00.0030.06716.16
5.3.290.0090.03812.80
5.3.280.0130.06714.50
5.3.270.0130.06014.63
5.3.260.0130.07014.89
5.3.250.0100.07314.88
5.3.240.0100.08314.68
5.3.230.0100.06714.91
5.3.220.0170.04314.77
5.3.210.0230.06014.75
5.3.200.0030.06014.46
5.3.190.0000.06014.86
5.3.180.0030.05714.88
5.3.170.0170.04314.77
5.3.160.0130.05314.63
5.3.150.0100.06014.58
5.3.140.0070.06314.69
5.3.130.0270.05714.76
5.3.120.0070.05714.74
5.3.110.0170.05314.82
5.3.100.0070.07014.34
5.3.90.0070.05314.30
5.3.80.0170.04714.34
5.3.70.0130.05314.04
5.3.60.0030.06014.22
5.3.50.0100.05013.85
5.3.40.0130.04314.18
5.3.30.0070.06714.22
5.3.20.0030.07013.77
5.3.10.0100.05313.95
5.3.00.0170.06313.94
5.2.170.0070.05711.37
5.2.160.0070.04711.05
5.2.150.0170.04711.47
5.2.140.0070.04311.22
5.2.130.0070.05011.42
5.2.120.0070.05311.01
5.2.110.0070.04311.24
5.2.100.0070.04011.12
5.2.90.0170.04010.97
5.2.80.0330.03011.18
5.2.70.0130.05011.29
5.2.60.0070.04311.13
5.2.50.0070.04011.26
5.2.40.0070.05011.20
5.2.30.0100.05311.18
5.2.20.0000.04711.14
5.2.10.0030.04710.93
5.2.00.0100.04711.05
5.1.60.0070.03010.31
5.1.50.0000.04010.23
5.1.40.0070.04010.31
5.1.30.0070.05010.35
5.1.20.0030.03710.64
5.1.10.0070.04310.39
5.1.00.0100.0509.96
5.0.50.0070.0378.85
5.0.40.0070.0308.74
5.0.30.0070.0408.50
5.0.20.0100.0278.43
5.0.10.0030.0308.49
5.0.00.0030.0408.07
4.4.90.0030.0207.04
4.4.80.0070.0237.04
4.4.70.0000.0277.04
4.4.60.0030.0237.04
4.4.50.0070.0237.04
4.4.40.0000.0377.04
4.4.30.0030.0207.04
4.4.20.0030.0276.97
4.4.10.0070.0206.53
4.4.00.0130.0276.29
4.3.110.0070.0176.27
4.3.100.0030.0236.27
4.3.90.0070.0176.27
4.3.80.0000.0336.27
4.3.70.0000.0236.27
4.3.60.0030.0236.27
4.3.50.0070.0236.27
4.3.40.0070.0306.27
4.3.30.0070.0176.27
4.3.20.0070.0176.27
4.3.10.0000.0236.27
4.3.00.0030.01715.59

preferences:
68.82 ms | 400 KiB | 5 Q