3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ksortMultiDimensional(&$params = array()) { if (is_array($params)) { ksort($params); foreach ($params as &$p) { if (is_array($p)) { ksort($p); } } } } function process($params, $key, $version = 2) { ksortMultiDimensional($params); $baseString = prepareParams($params, $baseString); $baseString .= $key; if ($version == 2) { return md5($baseString); } return hash('sha256', $baseString); } function prepareParams($params = array(), $baseString = '') { foreach ($params as $key => $value) { if (!isset($value)) { continue; } if (is_array($value)) { foreach ($value as $k => $v) { $baseString .= $key . '[' . $k . ']' . '=' . ($v === false ? '0' : $v); } } else { $baseString .= $key . '=' . ($value === false ? '0' : $value); } } return $baseString; } $data = [ 'key1' => 'Hello', 'key2' => 2, 'key3' => [ 'key4' => 'hello', 'key5' => 'world', 'abc' => 'def', ], 'key0' => 'yolo', 'key11' => null, 'key111' => 1.2 ]; var_dump(process($data, 'my-private-key', 3));
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $baseString in /in/CiGCo on line 18 string(64) "d8aa8cf7e9233345745902cc0278d587c1750c2faa5fe09ac99ff5fd161049e1"

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