Use PHP Code into Laravel Blade

  661 views   1 year ago PHP

in this article, I will share with you how to write PHP code in laravel blade files. there is two ways you should be written PHP code in laravel's blade files. one if laravel provides one his framework method and the second one is the traditional  method of write PHP code in laravel blade file. I will share with you both of example here.

Example : 1

@php
    $Categories = explode(',', $value->category_name);
    $CategoriesSlug = explode(',', $value->category_slug);
@endphp

Example : 2

category_name);
    $CategoriesSlug = explode(',', $value->category_slug);
?>

i hope it will help you.

Author : Harsukh Makwana
Harsukh Makwana

Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]