Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Add more value affter json endcode

$response = array(
    "aaData" => $data

);

echo json_encode($response);

how to add more name = ‘123’, data = $data

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You can push data into the array or you can define the array and assign value by key
Example

   $response = [];
   $response['name'] = '123';
   $response['data'] = 'mydata';
   $response['aaData'] = $data;

   echo json_decode($response);

$data can be array like this

   $data =[];
   $data['name'] = "ABCD";
   $data['id'] = 1;
   $response['aaData'] = $data;
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading