3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('WEIGHTS', [7, 3, 1]); define('WEIGHTS_COUNT', count(WEIGHTS)); $customerNumber = 1; $invoiceNumber = 25; $refBase = sprintf('%d%04d', $customerNumber, $invoiceNumber); $weightedSum = 0; for ($x = 0, $i = strlen($refBase) - 1; $i >=0; --$i, ++$x) { $weightedSum += $refBase[$i] * WEIGHTS[$x % WEIGHTS_COUNT]; } echo $refBase . (ceil($weightedSum / 10) * 10 - $weightedSum);
Output for git.master, git.master_jit, rfc.property-hooks
100256

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
83.08 ms | 405 KiB | 5 Q