3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = "9121221212119"; $calculate = function($input) { $sum = 0; $previousChar = $input[strlen($input) - 1]; foreach(str_split($input) as $char) { if ($char === $previousChar) { $sum += (int)$char; } $previousChar = $char; } return $sum; } var_dump($calculate($input));

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)
7.2.00.0060.01219.27
7.1.120.0070.00718.37
7.1.110.0090.00317.91
7.1.100.0040.01117.73
7.1.90.0060.01317.87
7.1.80.0110.00318.25
7.1.70.0100.00316.84
7.1.60.0160.01334.96
7.1.50.0180.01134.56
7.1.40.0180.01534.36
7.1.30.0160.01334.21
7.1.20.0160.01334.29
7.1.10.0060.00916.20
7.1.00.0030.01716.42

preferences:
141.07 ms | 1394 KiB | 7 Q