Skip to content

All topics  /  Laravel

How to Write PHP Code in Laravel Blade

Laravel ·

Hi Dev,

In this post, I will learn you how to write php code in laravel blade file.

I will explain step by step tutorial how to write php code in laravel. I’m going to show you about write php code in blade template laravel.

If you have question about write php code in laravel blade then i will give simple example with solution. In this article, we will implement a how to write php code in blade file in laravel. Here, Creating a basic example of how to write php code in laravel blade.Type a message

Example 1


@php
    $myArray = [
        "name" => "abc",
        "city" => "def",
        "mobile" => 123
    ];
    print_r($myArray);
@endphp

Example 2

<?php
    $myArray = [
        "name" => "abc",
        "city" => "def",
        "mobile" => 123
    ];
    print_r($myArray);
?>

It will help you...