- var_dump: documentation ( source)
- json_encode: documentation ( source)
<?php
// Create new stdClass with numeric attribute, stored as string.
$bla = new stdClass;
$bla->{"1012"} = "Value 1";
$bla->{1012} = "Value 2";
// Convert to array
$bla = (array) $bla;
if (!isset($bla[1012])) {
// ISSET fails, because it is now "1012" instead of 1012
var_dump($bla);
$bla[1012] = "Value 4";
}
var_dump($bla);
echo json_encode($bla);