3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $prefix = (string) 1234; $id = (string) 3; $number = $prefix . str_repeat('0', 12 - strlen($prefix) - strlen($id)) . $id; $odd = true; $checksum = 0; $key = range(0, 9); for ($i = strlen($number); $i > 0; $i--) { $checksum += $key[$number[$i - 1]] * ($odd ? 3 : 1); $odd = !$odd; } $checksum = 10 - $checksum % 10; $checksum = ($checksum == 10) ? 0 : $checksum; echo $number . $checksum;
Output for 5.2.15 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
1234000000039
Output for hhvm-3.10.0

Process exited with code 153.