Hey everyone, why does this not work?
echo new DateTime()->getOffset();
I get this error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';'
it seems like the -> operator only works when theres a $ somewhere before it in the line. Are there any simpler workarounds than saying this?:
$d = new DateTime();
echo $d->getOffset();
(it's not just with the DateTime, its with any object and any method. seems like new Anything()->aMethod() never works)
It would seem like a pretty common thing, and I tried searching for the answer, but I couldn't come up with the right keywords... and google strips out -> and ()...
Thanks for your comments,