encode() public method

public encode ( array $data )
$data array
Example #1
0
 public function testEncoding()
 {
     $formatter = new JSON();
     $data = array('name' => 'Joe', 'age' => 21, 'employed' => true);
     $options = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : null;
     $this->assertSame(json_encode($data, $options), $formatter->encode($data));
 }