What is the method return type declaration for json in zend framework

51 Views Asked by At

In zend framework for APIs, I am using $this->_helper->json($data) to return json data

public function get()
{
   $data = ['id' => 1, 'name' => 'xyz'];

   return $this->_helper->json($data);
}

Here I want to declare return type for this method. Generally for json_encode return type is string, but here what is the exact retun type to delcare in method return type.

1

There are 1 best solutions below

0
Gavin On

PHP doesn't have a nataive dataype for JSON, it's a structured string so your function is returning a string.