Support the ongoing development of Laravel.io →
Blade
Last updated 1 year ago.
0

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

Last updated 1 year ago.
0

I didn't put the brackets around the $c variable, that's the output of the Blade example extension.

Last updated 1 year ago.
0

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.

Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

IOM instanceofmichael Joined 11 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.