3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = trim('0'); if ($str) { echo "option 1: not empty\n"; } if (strlen($str)) { echo "option 2: not empty\n"; } if (!empty($str)) { echo "option 3: not empty\n"; } if ($str !== '') { echo "option 4: not empty\n"; }<?php

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)
5.4.240.0050.03812.37
5.4.230.0020.04412.36
5.4.220.0070.03512.36
5.4.210.0040.03612.36
5.4.200.0050.03912.36
5.4.190.0050.03612.35
5.4.180.0050.04212.36
5.4.170.0070.03512.36
5.4.160.0040.03612.36
5.4.150.0040.03612.35
5.4.140.0050.03812.04
5.4.130.0080.04012.02
5.4.120.0070.04211.99
5.4.110.0050.04111.99
5.4.100.0070.03511.98
5.4.90.0050.03711.98
5.4.80.0050.04111.98
5.4.70.0070.03411.98
5.4.60.0050.04211.98
5.4.50.0060.03411.98
5.4.40.0050.03511.96
5.4.30.0040.04011.96
5.4.20.0040.03611.96
5.4.10.0050.03511.96
5.4.00.0040.03711.45
5.3.280.0040.04112.71
5.3.270.0040.04712.72
5.3.260.0040.03912.72
5.3.250.0040.03812.72
5.3.240.0050.03612.72
5.3.230.0050.03612.71
5.3.220.0070.03812.68
5.3.210.0040.04512.68
5.3.200.0090.04012.68
5.3.190.0050.03912.68
5.3.180.0070.04212.67
5.3.170.0100.03812.67
5.3.160.0050.03712.67
5.3.150.0050.03712.67
5.3.140.0070.03612.66
5.3.130.0070.03812.66
5.3.120.0090.03712.66
5.3.110.0080.03812.66
5.3.100.0050.03812.12
5.3.90.0070.03612.08
5.3.80.0070.04012.07
5.3.70.0050.03812.08
5.3.60.0070.03512.06
5.3.50.0040.03612.00
5.3.40.0070.03512.00
5.3.30.0040.03811.94
5.3.20.0040.03611.70
5.3.10.0070.03311.66
5.3.00.0060.03911.64
5.2.170.0080.0349.15
5.2.160.0040.0319.15
5.2.150.0050.0329.15
5.2.140.0040.0329.14
5.2.130.0070.0309.10
5.2.120.0040.0299.10
5.2.110.0040.0319.11
5.2.100.0060.0349.11
5.2.90.0080.0369.11
5.2.80.0070.0329.10
5.2.70.0050.0329.10
5.2.60.0040.0309.06
5.2.50.0070.0289.03
5.2.40.0050.0279.00
5.2.30.0030.0328.97
5.2.20.0030.0308.97
5.2.10.0050.0348.89
5.2.00.0070.0338.74
5.1.60.0050.0298.03
5.1.50.0040.0308.03
5.1.40.0060.0278.02
5.1.30.0030.0298.36
5.1.20.0030.0298.39
5.1.10.0070.0238.11
5.1.00.0020.0278.11
5.0.50.0040.0206.59
5.0.40.0030.0196.45
5.0.30.0020.0316.27
5.0.20.0050.0216.23
5.0.10.0050.0216.21
5.0.00.0050.0336.21
4.4.90.0020.0194.78
4.4.80.0030.0154.76
4.4.70.0020.0164.76
4.4.60.0040.0144.76
4.4.50.0020.0154.77
4.4.40.0030.0274.71
4.4.30.0050.0194.76
4.4.20.0040.0194.85
4.4.10.0030.0164.85
4.4.00.0020.0274.76
4.3.110.0010.0174.67
4.3.100.0040.0134.67
4.3.90.0020.0154.63
4.3.80.0030.0244.58
4.3.70.0040.0154.63
4.3.60.0040.0144.63
4.3.50.0020.0164.62
4.3.40.0030.0244.54
4.3.30.0020.0163.28
4.3.20.0020.0163.25
4.3.10.0020.0183.22
4.3.00.0070.0237.26

preferences:
141.36 ms | 1394 KiB | 7 Q