- var_dump: documentation ( source)
- json_encode: documentation ( source)
<?php
$array = array(
array(
'id' => 'foo',
'content' => 'bar'
), array(
'id' => 'hello',
'content' => 'world'
)
);
var_dump( json_encode($array, JSON_FORCE_OBJECT) );