There are many useful PHP functions which an developer might use from time to time in their application. To use PHP in a blade there are two methods:

  1. Traditional method
  2. Blade Template method

Traditional Method

You can simply insert your PHP code within php tags and it will work. For example:

The above will echo something like: Sunday 22nd of January 2017 09:25:00 PM

But it is good and easy to use Blade Template method.

Blade Template Method

above PHP code can be passed as following way:

So in above example, @php and @endphp is replaced as <?php and ?>