3v4l.org

run code in 300+ PHP versions simultaneously
<?php //$values = [ 16, 32, 48]; $values = range(16, 1000000, 2); function getCmmdc($values) { $num_values = count($values); $x = current($values); $y = next($values); for ($i = 1; $i < $num_values; $i ++) { $a = max($x, $y); $b = min($x, $y); $c= 1; do { $c = $a % $b; $gcf = $b; $a = $b; $b = $c; } while ($c != 0); $x = $gcf; $y = next($values); } //suma tuturor divizilorilor $sum = 0; for($i = 1; $i <= $gcf; $i ++){ $temp = $gcf % $i; if($temp == 0){ $sum += $i; } } return array($gcf, $sum); } getCmmdc($values)
Output for 5.4.0 - 5.4.30
Parse error: syntax error, unexpected end of file in /in/gF2YO on line 37
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected $end in /in/gF2YO on line 37
Process exited with code 255.

preferences:
185.12 ms | 1399 KiB | 67 Q