123 - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of 123.php
- <?php
- function sortRecursiveByKeys($array)
- {
- foreach ($array as &$value) {
- if (is_array($value)) {
- $value = sortRecursiveByKeys($value);
- }
- }
- ksort($array);
- return $array;
- }
- function preparePWParams($params = array())
- {
- return urldecode(http_build_query($params, null, ''));
- }
- function createPWSignature($input, string $secret)
- {
- $input = parse_url($input);
- parse_str($input['query'], $input);
- unset($input['sig']);
- $input = sortRecursiveByKeys($input);
- $baseString = preparePWParams($input);
- return hash_hmac('sha256', $baseString, $secret);
- }
- echo createPWSignature('http://games123.storefront.feature-ter-1787.terminal3.s3.stuffio.com/en?uid=234&promo[0][product_id]=234&promo[0][type]=discount&promo[0][calc]=percent&promo[0][value]=50&promo[1][product_id]=237&promo[1][type]=discount&promo[1][calc]=percent&promo[1][value]=50&country_code=US','tmhEvwYV3K13sh62XSCB10T9oWRfSksXvMQdL7LoRptTrxbFOYFNIP4AejdGxHMw');