I have to send data using JSON in a structure like this:
$JSONDATA=
array(
'response' => true,
'error' => null,
'payload' =>
array(
'content' => $content,
'size' => $size
)
);
NOTE: the variable $content is a dynamic associative array, so its size is not constant. The JSON output is sent using the classical system:
$joutput=json_encode($JSONDATA,JSON_NUMERIC_CHECK);
echo $joutput;
The question is: how can I evaluate the variable $size dynamically and include it in the output?