3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function _createUniqueSkuPartFromId($configurableId){ echo 'calling ' . __FUNCTION__ . '(' . $configurableId . ')' . PHP_EOL; $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $charsLength = strlen($chars); $characterPart = ''; $value = $configurableId; for($i = 3; $i > 0 ; $i--) { echo PHP_EOL . '$i = ' . $i; var_dump($value); $mod = $value % $charsLength; $floordiv = $value/$charsLength; var_dump($mod, $floordiv); $characterPart = $chars {$mod} . $characterPart; $value = $floordiv; } $numberPart = str_pad(99 - ($configurableId % 100), 2, '0', STR_PAD_LEFT); echo 'done, created number part and character part that are expected to be unique ' . PHP_EOL; echo '$numberPart: ' . $numberPart . PHP_EOL; echo '$characterPart: ' . $characterPart . PHP_EOL; echo 'concated: ' . $numberPart.$characterPart.PHP_EOL . '----------------------------' . PHP_EOL; return $numberPart . $characterPart; } $range = array(100, 105);
Output for 4.3.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
Output for hhvm-3.10.0

Process exited with code 153.