3v4l.org

run code in 300+ PHP versions simultaneously
<?php $map = [ 6 => 215601, 11 => 3260461, 7 => 210282, 11 => 3258941 ]; foreach($map as $key => $value) { $p = str_pad($key, 3, '0', STR_PAD_LEFT) . str_pad($value, 10, '0', STR_PAD_LEFT); echo "\n"; echo $p; $ctr = 22; $ctro = '0' . substr($p,1,2) . substr($p,6); echo "\n"; echo $ctro; for ($i=0; $i <= 8; $i+=2) { $ctr = $ctr + 3*(int)substr($ctro,$i,1) + (int)substr($ctro,(1+$i),1); } echo "\n"; echo $ctr; $ctr = (10 - ($ctr % 10)) % 10; echo "\n"; echo "Key = " . $ctr; }
Output for 5.6.38, 7.1.0 - 7.1.23, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
0060000215601 0060215601 69 Key = 1 0110003258941 0113258941 86 Key = 4 0070000210282 0070210282 78 Key = 2
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 0060000215601 0060215601 69 Key = 1 0110003258941 0113258941 86 Key = 4 0070000210282 0070210282 78 Key = 2

preferences:
155.64 ms | 402 KiB | 177 Q