salama2121 salama2121 - 1 month ago 5x
HTML Question

PHP what is the difference between { } and {{ }}

I'm using PHP Laravel framework and I came to some code examples where {{ }} is use inside a html code, like this:

<link rel="stylesheet" href=" {{ URL::to('css/app.css') }} ">

My conclusion is that the {{ }} are used to write no-HTML code inside the HTML, is that correct?

And for what is the { } used?

Thanks for your answer.


There is no { } in Blade, {{ }} displays escaped data and {!! !!} displays unescaped data.

By default, Blade {{ }} statements are automatically sent through PHP's htmlentities function to prevent XSS attacks. If you do not want your data to be escaped, you may use the following syntax:

Hello, {!! $name !!}.