- Output for 7.1.17
- Parse error: syntax error, unexpected '}', expecting ';' in /in/gfMs1 on line 17
Process exited with code 255.
<?php
class Test
{
public $a = 'a';
protected $b = 'b';
private $c = 'c';
}
function objectToArray ($object)
{
$array = (array) $object;
return array_combine(
array_map(function($k) { return $k}, array_keys($array)),
array_values($array)
);
}
$array = objectToArray( new \Test());
var_export((array) new \Test());