#!/usr/bin/env php $cls->name]; foreach ($cls->getProperties() as $prop) { $prop->setAccessible(true); $fields[$prop->getName()] = to_array($prop->getValue($obj)); } return $fields; } $args = array_slice($argv, 1); if (empty($args)) $args[] = '-'; foreach ($args as $arg) { if ($arg === '-') $arg = 'php://stdin'; echo json_encode(to_array(unserialize(file_get_contents($arg)))) . PHP_EOL; }