Rajkumar Patidar
Rajkumar Patidar

Reputation: 45

What is the difference between {{-- --}} and {{ }} in laravel framework blade files?

In the laravel framework we can use blade to add PHP code in html file.

We are using both {{-- --}} and {!! !!} syntax in blade files of Laravel framework .

What is the basic difference between them?

Upvotes: 0

Views: 228

Answers (4)

thmspl
thmspl

Reputation: 2495

{{-- --}} is to create comments in your blade files.

{!! !!} is for displaying data without escaping it.

You can read about those in the laravel docs:

https://laravel.com/docs/5.8/blade#comments https://laravel.com/docs/5.8/blade#displaying-data

Upvotes: 1

Shailendra Gupta
Shailendra Gupta

Reputation: 1128

{{-- This comment will not be present in the rendered HTML --}}

{!! it is used for escape html while rendering !!}

Upvotes: 0

dparoli
dparoli

Reputation: 9171

The first {{-- --}} is used for Blade comments, it will not be displayed in HTML.

The second {!! !!} is used to display unescaped data.

Upvotes: 0

Kishore Kadiyala
Kishore Kadiyala

Reputation: 164

{{-- --}} is used to include comments, {!! !!} is used to display a variable without escaping it, for example to display html content.

Upvotes: 1

Related Questions