3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $verificationCode = '6g8998f53f98d69cbdf07c789a7ec1284b9gaeab573a0dc94e76a4db9ceg21a4'; $request = [ "title" => "57c58ce24b1e15e8358b4568", "body" => "57c58ce24b1e15e8358b4568", "charset" => "UTF-8", "isApp" => "app", "defaultbank" => "ICBC", "merchantId" => "100000000002698", "notifyUrl" => "https://requestb.in/12q245v1", "orderNo" => "57c58ce24b1e15e8358b4568", "paymentType" => "1", "paymethod" => "directPay", "returnUrl" => "http://china.isitdomain.com", "service" => "online_pay", "totalFee" => "1.0" ]; // var_dump($request); $request = array_filter($request); // var_dump($request); ksort($request); var_dump($request); // $signParams = []; // foreach ($request as $key => $value) { // $signParams[] = "{$key}={$value}"; // } // $rawSign = implode('&', $signParams) . $verificationCode; $rawSign = http_build_query($request) . $verificationCode; var_dump($rawSign); $sign = strtoupper(sha1($rawSign)); $url = "https://ebank.ztpo.cn/payment/v1/order/100000000002698-57c58ce24b1e15e8358b4567?"; $request['signType'] = 'SHA'; $request['sign'] = $sign; $readyUrl = $url . http_build_query($request); echo $sign, PHP_EOL; echo $readyUrl, PHP_EOL;
Output for 7.2.1
array(13) { ["body"]=> string(24) "57c58ce24b1e15e8358b4568" ["charset"]=> string(5) "UTF-8" ["defaultbank"]=> string(4) "ICBC" ["isApp"]=> string(3) "app" ["merchantId"]=> string(15) "100000000002698" ["notifyUrl"]=> string(28) "https://requestb.in/12q245v1" ["orderNo"]=> string(24) "57c58ce24b1e15e8358b4568" ["paymentType"]=> string(1) "1" ["paymethod"]=> string(9) "directPay" ["returnUrl"]=> string(27) "http://china.isitdomain.com" ["service"]=> string(10) "online_pay" ["title"]=> string(24) "57c58ce24b1e15e8358b4568" ["totalFee"]=> string(3) "1.0" } string(382) "body=57c58ce24b1e15e8358b4568&charset=UTF-8&defaultbank=ICBC&isApp=app&merchantId=100000000002698&notifyUrl=https%3A%2F%2Frequestb.in%2F12q245v1&orderNo=57c58ce24b1e15e8358b4568&paymentType=1&paymethod=directPay&returnUrl=http%3A%2F%2Fchina.isitdomain.com&service=online_pay&title=57c58ce24b1e15e8358b4568&totalFee=1.06g8998f53f98d69cbdf07c789a7ec1284b9gaeab573a0dc94e76a4db9ceg21a4" CCE781D3B36F70DD339E2E3869E19C4DFAE49C16 https://ebank.ztpo.cn/payment/v1/order/100000000002698-57c58ce24b1e15e8358b4567?body=57c58ce24b1e15e8358b4568&charset=UTF-8&defaultbank=ICBC&isApp=app&merchantId=100000000002698&notifyUrl=https%3A%2F%2Frequestb.in%2F12q245v1&orderNo=57c58ce24b1e15e8358b4568&paymentType=1&paymethod=directPay&returnUrl=http%3A%2F%2Fchina.isitdomain.com&service=online_pay&title=57c58ce24b1e15e8358b4568&totalFee=1.0&signType=SHA&sign=CCE781D3B36F70DD339E2E3869E19C4DFAE49C16