- strtr: documentation ( source)
- print_r: documentation ( source)
<?php
$dp = new DatePeriod(new DateTime('2010-01-01'), new DateInterval('P1D'), 2);
$r = new ReflectionObject($dp);
$arr = (array)$dp; // cast to array to see the values of propeties
echo "Properties:\r\n";
foreach($r->getProperties() as $v) {
echo $v->getName()."\r\n";
}
echo "\r\n";
echo "Methods:\r\n";
foreach($r->getMethods() as $v) {
echo $v->getName()."\r\n";
}
echo "\r\n";
echo "Array cast:\r\n";
echo strtr(print_r($arr, true), "\0", '_');