Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

laravel

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. What is the difference between them?

i have a code in a blade file like this

{{{ $errors->has('slider') ? 'has-error' : '' }}}
like image 756
hkguile Avatar asked Nov 27 '22 16:11

hkguile


1 Answers

Before Laravel 5:

  • {{{ $var }}} escapes the contents of $var
  • {{ $var }} echoes $var unescaped

Since Laravel 5:

  • {{ $var }} AND {{{ $var }}} escape the contents of $var
  • {!! $var !!} echoes $var unescaped
like image 132
Rok Novosel Avatar answered Dec 05 '22 23:12

Rok Novosel