Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

EliyaCohen's avatar

Combining a php variable with an angular scope.

I have a tricky issue when I try to call an angular scope with php variable.

for example, I have this php code:

$php = 'some';

and I have these scopes in my javascript:

$scope.var = 'var';
$scope.some_var = 'the requested var';

now, in my blade file I want to call the some_var scope. so I type:

{{ '{{' . $php . '_var }}' }}

but It just threw an error:

FatalErrorException in 6a710b39bb206fff0d7fa9c979c1c148 line 62:
syntax error, unexpected '}'

I know I can replace the {{ }} to <?= ?> but it doesn't seems ok.. does anyone has a better solution?

0 likes
1 reply
bjones2015's avatar

You'd need to check out Jeffery's latest (I think) vue video, but it seem like he proceed {{ }} that he didn't want to be interpreted by blade with the @ symbol.

Please or to participate in this conversation.