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 = range(100, 105); foreach ($range as $configId) { _createUniqueSkuPartFromId($configId); }
Output for 5.0.2 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
calling _createUniqueSkuPartFromId(100) $i = 3int(100) int(22) float(3.8461538461538) $i = 2float(3.8461538461538) int(3) float(0.14792899408284) $i = 1float(0.14792899408284) int(0) float(0.0056895766954939) done, created number part and character part that are expected to be unique $numberPart: 99 $characterPart: ADW concated: 99ADW ---------------------------- calling _createUniqueSkuPartFromId(101) $i = 3int(101) int(23) float(3.8846153846154) $i = 2float(3.8846153846154) int(3) float(0.14940828402367) $i = 1float(0.14940828402367) int(0) float(0.0057464724624488) done, created number part and character part that are expected to be unique $numberPart: 98 $characterPart: ADX concated: 98ADX ---------------------------- calling _createUniqueSkuPartFromId(102) $i = 3int(102) int(24) float(3.9230769230769) $i = 2float(3.9230769230769) int(3) float(0.1508875739645) $i = 1float(0.1508875739645) int(0) float(0.0058033682294037) done, created number part and character part that are expected to be unique $numberPart: 97 $characterPart: ADY concated: 97ADY ---------------------------- calling _createUniqueSkuPartFromId(103) $i = 3int(103) int(25) float(3.9615384615385) $i = 2float(3.9615384615385) int(3) float(0.15236686390533) $i = 1float(0.15236686390533) int(0) float(0.0058602639963587) done, created number part and character part that are expected to be unique $numberPart: 96 $characterPart: ADZ concated: 96ADZ ---------------------------- calling _createUniqueSkuPartFromId(104) $i = 3int(104) int(0) int(4) $i = 2int(4) int(4) float(0.15384615384615) $i = 1float(0.15384615384615) int(0) float(0.0059171597633136) done, created number part and character part that are expected to be unique $numberPart: 95 $characterPart: AEA concated: 95AEA ---------------------------- calling _createUniqueSkuPartFromId(105) $i = 3int(105) int(1) float(4.0384615384615) $i = 2float(4.0384615384615) int(4) float(0.15532544378698) $i = 1float(0.15532544378698) int(0) float(0.0059740555302685) done, created number part and character part that are expected to be unique $numberPart: 94 $characterPart: AEB concated: 94AEB ----------------------------
Output for 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 5 calling _createUniqueSkuPartFromId(100)PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 3int(100) int(22) float(3.8461538461538) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 2float(3.8461538461538) int(3) float(0.14792899408284) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 1float(0.14792899408284) int(0) float(0.0056895766954939) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 26 done, created number part and character part that are expected to be unique PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 27 $numberPart: 99PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 28 $characterPart: ADWPHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 29 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 29 concated: 99ADWPHP_EOL----------------------------PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 5 calling _createUniqueSkuPartFromId(101)PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 3int(101) int(23) float(3.8846153846154) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 2float(3.8846153846154) int(3) float(0.14940828402367) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 1float(0.14940828402367) int(0) float(0.0057464724624488) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 26 done, created number part and character part that are expected to be unique PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 27 $numberPart: 98PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 28 $characterPart: ADXPHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 29 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 29 concated: 98ADXPHP_EOL----------------------------PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 5 calling _createUniqueSkuPartFromId(102)PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 3int(102) int(24) float(3.9230769230769) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 2float(3.9230769230769) int(3) float(0.1508875739645) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 1float(0.1508875739645) int(0) float(0.0058033682294037) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 26 done, created number part and character part that are expected to be unique PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 27 $numberPart: 97PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 28 $characterPart: ADYPHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 29 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 29 concated: 97ADYPHP_EOL----------------------------PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 5 calling _createUniqueSkuPartFromId(103)PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 3int(103) int(25) float(3.9615384615385) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 2float(3.9615384615385) int(3) float(0.15236686390533) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 1float(0.15236686390533) int(0) float(0.0058602639963587) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 26 done, created number part and character part that are expected to be unique PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 27 $numberPart: 96PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 28 $characterPart: ADZPHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 29 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 29 concated: 96ADZPHP_EOL----------------------------PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 5 calling _createUniqueSkuPartFromId(104)PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 3int(104) int(0) int(4) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 2int(4) int(4) float(0.15384615384615) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 1float(0.15384615384615) int(0) float(0.0059171597633136) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 26 done, created number part and character part that are expected to be unique PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 27 $numberPart: 95PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 28 $characterPart: AEAPHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 29 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 29 concated: 95AEAPHP_EOL----------------------------PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 5 calling _createUniqueSkuPartFromId(105)PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 3int(105) int(1) float(4.0384615384615) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 2float(4.0384615384615) int(4) float(0.15532544378698) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 1float(0.15532544378698) int(0) float(0.0059740555302685) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 26 done, created number part and character part that are expected to be unique PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 27 $numberPart: 94PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 28 $characterPart: AEBPHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 29 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 29 concated: 94AEBPHP_EOL----------------------------PHP_EOL
Output for 4.3.10 - 4.4.9
calling _createuniqueskupartfromid(100) $i = 3int(100) int(22) float(3.8461538461538) $i = 2float(3.8461538461538) int(3) float(0.14792899408284) $i = 1float(0.14792899408284) int(0) float(0.0056895766954939) done, created number part and character part that are expected to be unique $numberPart: 99 $characterPart: ADW concated: 99ADW ---------------------------- calling _createuniqueskupartfromid(101) $i = 3int(101) int(23) float(3.8846153846154) $i = 2float(3.8846153846154) int(3) float(0.14940828402367) $i = 1float(0.14940828402367) int(0) float(0.0057464724624488) done, created number part and character part that are expected to be unique $numberPart: 98 $characterPart: ADX concated: 98ADX ---------------------------- calling _createuniqueskupartfromid(102) $i = 3int(102) int(24) float(3.9230769230769) $i = 2float(3.9230769230769) int(3) float(0.1508875739645) $i = 1float(0.1508875739645) int(0) float(0.0058033682294037) done, created number part and character part that are expected to be unique $numberPart: 97 $characterPart: ADY concated: 97ADY ---------------------------- calling _createuniqueskupartfromid(103) $i = 3int(103) int(25) float(3.9615384615385) $i = 2float(3.9615384615385) int(3) float(0.15236686390533) $i = 1float(0.15236686390533) int(0) float(0.0058602639963587) done, created number part and character part that are expected to be unique $numberPart: 96 $characterPart: ADZ concated: 96ADZ ---------------------------- calling _createuniqueskupartfromid(104) $i = 3int(104) int(0) int(4) $i = 2int(4) int(4) float(0.15384615384615) $i = 1float(0.15384615384615) int(0) float(0.0059171597633136) done, created number part and character part that are expected to be unique $numberPart: 95 $characterPart: AEA concated: 95AEA ---------------------------- calling _createuniqueskupartfromid(105) $i = 3int(105) int(1) float(4.0384615384615) $i = 2float(4.0384615384615) int(4) float(0.15532544378698) $i = 1float(0.15532544378698) int(0) float(0.0059740555302685) done, created number part and character part that are expected to be unique $numberPart: 94 $characterPart: AEB concated: 94AEB ----------------------------
Output for 4.3.0 - 4.3.9
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 5 calling _createuniqueskupartfromid(100)PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 3int(100) int(22) float(3.8461538461538) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 2float(3.8461538461538) int(3) float(0.14792899408284) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 1float(0.14792899408284) int(0) float(0.0056895766954939) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 26 done, created number part and character part that are expected to be unique PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 27 $numberPart: 99PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 28 $characterPart: ADWPHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 29 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 29 concated: 99ADWPHP_EOL----------------------------PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 5 calling _createuniqueskupartfromid(101)PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 3int(101) int(23) float(3.8846153846154) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 2float(3.8846153846154) int(3) float(0.14940828402367) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 1float(0.14940828402367) int(0) float(0.0057464724624488) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 26 done, created number part and character part that are expected to be unique PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 27 $numberPart: 98PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 28 $characterPart: ADXPHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 29 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 29 concated: 98ADXPHP_EOL----------------------------PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 5 calling _createuniqueskupartfromid(102)PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 3int(102) int(24) float(3.9230769230769) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 2float(3.9230769230769) int(3) float(0.1508875739645) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 1float(0.1508875739645) int(0) float(0.0058033682294037) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 26 done, created number part and character part that are expected to be unique PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 27 $numberPart: 97PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 28 $characterPart: ADYPHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 29 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 29 concated: 97ADYPHP_EOL----------------------------PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 5 calling _createuniqueskupartfromid(103)PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 3int(103) int(25) float(3.9615384615385) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 2float(3.9615384615385) int(3) float(0.15236686390533) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 1float(0.15236686390533) int(0) float(0.0058602639963587) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 26 done, created number part and character part that are expected to be unique PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 27 $numberPart: 96PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 28 $characterPart: ADZPHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 29 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 29 concated: 96ADZPHP_EOL----------------------------PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 5 calling _createuniqueskupartfromid(104)PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 3int(104) int(0) int(4) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 2int(4) int(4) float(0.15384615384615) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 1float(0.15384615384615) int(0) float(0.0059171597633136) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 26 done, created number part and character part that are expected to be unique PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 27 $numberPart: 95PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 28 $characterPart: AEAPHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 29 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 29 concated: 95AEAPHP_EOL----------------------------PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 5 calling _createuniqueskupartfromid(105)PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 3int(105) int(1) float(4.0384615384615) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 2float(4.0384615384615) int(4) float(0.15532544378698) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 12 PHP_EOL$i = 1float(0.15532544378698) int(0) float(0.0059740555302685) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 26 done, created number part and character part that are expected to be unique PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 27 $numberPart: 94PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 28 $characterPart: AEBPHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 29 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/h8VS7 on line 29 concated: 94AEBPHP_EOL----------------------------PHP_EOL