3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); function pnl(string $string){ print($string . PHP_EOL . PHP_EOL); } $paragraph = <<<PARA Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. PARA; $a = substr($paragraph,15,12); pnl('Sub String:'); pnl($a); $last20 = substr($paragraph, -20, 20); $b = strpos($paragraph, 'simply'); pnl('Starting postion of first simply: ' . $b); $last = strrpos($paragraph, 'Lorem'); pnl('Starting postion of last Lorem: ' . $last); $c = stripos($paragraph,'SImpLY'); pnl('Starting postion of first SImpLY (case insensative): ' . $c); $d = strstr($paragraph, 'simply'); pnl('String String:'); pnl($d); $e = str_replace('Lorem Ipsum', 'Heyyy', $paragraph); pnl('Replacing Strings:'); pnl($e); $f = str_ireplace('HEYYY', 'Oh', $e); pnl('Replacing Strings Case Insensitive:'); pnl($f); $g = strlen($paragraph); pnl('Length of the whole paragraph: ' . $g); $startPos = stripos($paragraph,'SpeCimen'); $len = $g - $startPos; $mystrstr = substr($paragraph, $startPos, $len); pnl('My Own strstr:'); pnl($mystrstr); $lenLast = $g - $last; $llo = substr($paragraph, $last, $lenLast); $lloo = substr($paragraph, 0 - $lenLast, $lenLast); pnl('Last Lorem Onwards:'); pnl($llo); pnl('or:'); pnl($lloo); $firstSpaceInLlo = strpos($llo, ' '); $justLastLorem = substr($llo, 0, $firstSpaceInLlo); pnl('Just the last lorem (diff way?):'); pnl($justLastLorem); $toChange = 'it'; $lastIt = strripos($paragraph, $toChange); $changeTo = substr($paragraph, $lastIt, strlen($toChange)); $changed = str_ireplace($toChange, $changeTo, $paragraph); pnl('Change all \'it\' to match the last \'it\':'); pnl($changed); $cap = str_replace(['a','e','i','o','u'], ['A','E','I','O','U'], $paragraph); pnl('Capitalise vowels:'); pnl($cap);

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.4.20.0140.00718.89
8.4.10.0100.00619.61
8.3.140.0060.01216.59
8.3.130.0040.00418.56
8.3.120.0000.00818.87
8.3.110.0060.00320.94
8.3.100.0070.00324.06
8.3.90.0050.00326.77
8.3.80.0040.00819.36
8.3.70.0070.01116.58
8.3.60.0140.00316.50
8.3.50.0060.00917.38
8.3.40.0150.00018.84
8.3.30.0090.00618.79
8.3.20.0000.00821.73
8.3.10.0040.00419.02
8.3.00.0050.00321.83
8.2.260.0090.00918.74
8.2.250.0030.00518.35
8.2.240.0000.01017.46
8.2.230.0040.00422.58
8.2.220.0070.00337.54
8.2.210.0040.00426.77
8.2.200.0000.01018.88
8.2.190.0110.00716.88
8.2.180.0120.00325.92
8.2.170.0070.01022.96
8.2.160.0110.00322.16
8.2.150.0060.00324.18
8.2.140.0040.00424.66
8.2.130.0000.00726.16
8.2.120.0040.00418.72
8.2.110.0030.00622.29
8.2.100.0080.00417.72
8.2.90.0040.00418.22
8.2.80.0080.00017.97
8.2.70.0000.00917.93
8.2.60.0040.00418.22
8.2.50.0050.00319.34
8.2.40.0090.00019.30
8.2.30.0030.00520.38
8.2.20.0070.00017.97
8.2.10.0000.00719.02
8.2.00.0040.00418.23
8.1.310.0110.00416.75
8.1.300.0060.00920.18
8.1.290.0040.00430.84
8.1.280.0070.01025.92
8.1.270.0080.00022.20
8.1.260.0060.00326.35
8.1.250.0040.00428.09
8.1.240.0060.00322.18
8.1.230.0110.00020.98
8.1.220.0080.00017.75
8.1.210.0050.00318.77
8.1.200.0040.00417.35
8.1.190.0040.00417.23
8.1.180.0030.00618.10
8.1.170.0030.00618.59
8.1.160.0050.00318.79
8.1.150.0000.00718.97
8.1.140.0000.00720.28
8.1.130.0040.00421.78
8.1.120.0040.00417.50
8.1.110.0080.00317.39
8.1.100.0040.00417.43
8.1.90.0030.00617.47
8.1.80.0060.00317.52
8.1.70.0000.00817.41
8.1.60.0030.00517.57
8.1.50.0000.00717.53
8.1.40.0030.00617.55
8.1.30.0000.00817.57
8.1.20.0000.00917.51
8.1.10.0000.00817.59
8.1.00.0040.00417.36
8.0.300.0040.00419.71
8.0.290.0050.00316.75
8.0.280.0030.00318.47
8.0.270.0030.00317.29
8.0.260.0030.00318.45
8.0.250.0000.00716.99
8.0.240.0070.00017.03
8.0.230.0030.00316.94
8.0.220.0040.00416.88
8.0.210.0030.00317.00
8.0.200.0070.00017.04
8.0.190.0000.00917.04
8.0.180.0040.00416.90
8.0.170.0040.00416.88
8.0.160.0030.00516.93
8.0.150.0050.00216.94
8.0.140.0040.00416.99
8.0.130.0030.00313.36
8.0.120.0080.00016.84
8.0.110.0040.00417.05
8.0.100.0040.00416.88
8.0.90.0000.00716.79
8.0.80.0060.00916.89
8.0.70.0040.00416.98
8.0.60.0000.00816.91
8.0.50.0000.00716.87
8.0.30.0060.01017.02
8.0.20.0120.01217.43
8.0.10.0000.00717.00
8.0.00.0100.00916.85
7.4.330.0000.00515.55
7.4.320.0070.00016.43
7.4.300.0030.00316.54
7.4.290.0040.00416.39
7.4.280.0030.00616.67
7.4.270.0000.00816.56
7.4.260.0000.00716.48
7.4.250.0040.00416.60
7.4.240.0030.00516.40
7.4.230.0030.00316.45
7.4.220.0030.00516.52
7.4.210.0070.01116.68
7.4.200.0030.00316.38
7.4.160.0100.00716.59
7.4.140.0150.00917.86
7.4.130.0100.00716.57
7.4.120.0070.01016.44
7.4.110.0060.01216.60
7.4.100.0180.00016.53
7.4.90.0150.00416.69
7.4.80.0090.01219.39
7.4.70.0120.01216.37
7.4.60.0100.00816.43
7.4.50.0040.01216.63
7.4.40.0200.00316.63
7.4.00.0050.01314.93
7.3.330.0050.00013.44
7.3.320.0000.00513.46
7.3.310.0040.00416.36
7.3.300.0000.00716.43
7.3.290.0030.00316.41
7.3.280.0100.00916.38
7.3.260.0110.00816.57
7.3.240.0080.01016.60
7.3.230.0140.00416.74
7.3.210.0040.01416.53
7.3.200.0090.01116.45
7.3.190.0150.00916.38
7.3.180.0070.01116.43
7.3.170.0090.01316.62
7.3.160.0090.00616.70
7.3.120.0060.01314.91
7.3.110.0140.00514.95
7.3.100.0090.00714.97
7.3.90.0140.00314.99
7.3.80.0020.01014.87
7.3.70.0040.00914.68
7.3.60.0120.00314.86
7.3.50.0050.00914.88
7.3.40.0080.00714.86
7.3.30.0100.00314.71
7.3.20.0080.00916.02
7.3.10.0090.00816.22
7.3.00.0050.00815.98
7.2.330.0030.01416.81
7.2.320.0090.00916.79
7.2.310.0120.00616.77
7.2.300.0150.00316.75
7.2.290.0100.01016.86
7.2.250.0070.01015.24
7.2.240.0060.01315.09
7.2.230.0110.00714.97
7.2.220.0070.00815.02
7.2.210.0050.01015.15
7.2.200.0040.00615.17
7.2.190.0020.01615.13
7.2.180.0070.01115.06
7.2.170.0090.00815.06
7.2.160.0090.00615.16
7.2.150.0110.00715.87
7.2.140.0060.01116.04
7.2.130.0060.00816.03
7.2.120.0040.01016.03
7.2.110.0380.01215.93
7.2.100.0100.00716.15
7.2.90.0070.00916.14
7.2.80.0050.01116.03
7.2.70.0080.01016.08
7.2.60.0070.00916.11
7.2.50.0130.00315.97
7.2.40.0160.00315.94
7.2.30.0080.01016.14
7.2.20.0120.00116.15
7.2.10.0080.00716.08
7.2.00.0120.00616.05
7.1.330.0020.01615.85
7.1.320.0060.00615.71
7.1.310.0060.00715.77
7.1.300.0080.00615.59
7.1.290.0070.00615.68
7.1.280.0040.01015.03
7.1.270.0100.00515.14
7.1.260.0070.00715.07
7.1.250.0050.00814.90

preferences:
35.34 ms | 403 KiB | 5 Q