3v4l.org

run code in 300+ PHP versions simultaneously
<?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); foreach ($range as $configId) { _createUniqueSkuPartFromId($configId); }
Output for git.master, git.master_jit
Fatal error: Array and string offset access syntax with curly braces is no longer supported in /in/g4sPP on line 20
Process exited with code 255.
Output for rfc.property-hooks
Parse error: syntax error, unexpected token "{" in /in/g4sPP on line 20
Process exited with code 255.

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:
41.28 ms | 401 KiB | 8 Q