Hello Devs,

In this tutorial, we are going to learn how to write php code in laravel blade file.




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);

?>


I hope this example helps you.