[Solved] Php: how to access object individual elements [closed]


You can access the date value in two different ways.

Number one: Use __toString()

echo $var->__toString();
// or
echo (string)$var;

Number two: Use the DateTime format method:

echo $var->format('Y-m-d H:i:s');

solved Php: how to access object individual elements [closed]