3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('WEIGHTS', [7, 3, 1]); define('WEIGHTS_COUNT', count(WEIGHTS)); $customerNumber = 1; $invoiceNumber = 25; echo ($refBase = sprintf('%d%04d', $customerNumber, $invoiceNumber)) . $verificationDigit = ( fn($weightedSum) => (ceil($weightedSum / 10) * 10 - $weightedSum) )(array_reduce( str_split(strrev($refBase)), function($result, $v) { static $i; $i ??= 0; return $result + ($v * WEIGHTS[$i++ % WEIGHTS_COUNT]); }, 0 ) );
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:
98.7 ms | 405 KiB | 5 Q