3v4l.org

run code in 300+ PHP versions simultaneously
<?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, 7.3.24 - 7.3.33, 7.4.12 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
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
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 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

preferences:
149.22 ms | 405 KiB | 119 Q