I want to have an empty object in the API response like the one mentioned below:
{
"sample" : {}
}
When I assign $response['sample'] = array(), I get the following response
{
"sample" : []
}
{} indicates an object so you have to use
$result = ["sample" => new stdclass()];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With