You don't need the brackets around the $c
variable. This should suffice:
$c = Carbon::now();
echo $c->format('m/d/Y H:i');
Mei
I didn't put the brackets around the $c variable, that's the output of the Blade example extension.
I just ran into this and the documentation example is still wrong.
The problem is that the pattern from createMatcher includes the "(" and ")" in the capture group. So with the documentation example the $2 capture group result is actually ($var).
This works for the most part until you try to access properties on the var, then it becomes ($var)-> which causes the (T_OBJECT_OPERATOR) error.
With the documentation example, the $pattern created is
/(?<!\w)(\s*)@datetime(\s*\(.*\))/
Where it should be
/(?<!\w)(\s*)@datetime\s*\((.*)\)/
(Notice the placement change of the parenthesis capturing everything between "(" and ")" and not including them.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community