Anitha S
Anitha S

Reputation: 27

Symfony Twig Rendering

I am trying to bind variables with symfony template like {{ 2ctc5qxi }} {{ !applianceType_page2_5 }}. but i am getting error

Unexpected token "name" of value "ctc5qxi" ("end of print statement" expected)

But it is working fine with keys, that does not starts with numbers & special characters.Please help in this.

Upvotes: 0

Views: 158

Answers (2)

Fahad Shahid
Fahad Shahid

Reputation: 146

PHP variables can't start with a number. So make sure that name of variables is as per convention defined here. PHP Variables Basics

Upvotes: 3

dlondero
dlondero

Reputation: 2595

Just rename your variable 2ctc5qxi with something that starts with a letter or an underscore. Can't start with a number. As a regular expression, it would be expressed thus: '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'.

Upvotes: 2

Related Questions