<?php
$jsonString = '[{"salesid":130201411173700750}]';
// PHP code
$payments = json_decode(stripslashes(html_entity_decode(rtrim($jsonString, '\0'))), true);
$values = '';
foreach ($payments as $key => $value) {
$value = (object)$value;
if ($values != '') {
$values .= ',';
}
printResponse(false, "sales id: $value->salesid");
exit;
//more code omitted...
}
function printResponse($success, $data, $totalCount = 0) {
header('Content-Type: application/json;charset=UTF-8');
print json_encode((object)[
'success' => $success,
'data' => $data,
'totalCount' => $totalCount
]);
exit;
}
- Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
- {"success":false,"data":"sales id: 130201411173700750","totalCount":0}
preferences:
74.13 ms | 407 KiB | 5 Q