3v4l.org

run code in 300+ PHP versions simultaneously
<?php function signRequest($domain, $method, $public_key, $private_key, $data=array()){ $data = array_filter($data); // Normalise data if(array_key_exists('request_timestamp', $data)) { $data['request_timestamp'] = (int) $data['request_timestamp']; } ksort($data); $data = json_encode($data); $buffer = array($domain, $method, $data, $public_key); $buffer_str = implode(":", $buffer); return hash_hmac('sha256', $buffer_str, $private_key); } //echo signRequest("neom.dev", "products", "c7912e9a71d7208f", "767f791f93a272d3f4554116", []); echo time();

preferences:
42.58 ms | 402 KiB | 5 Q