Laravel Arr add() function Example

In this tutorial you will learn about the Laravel Arr add() function Example and its application with practical example.

Laravel Arr add() function Example

In this article, we will learn about laravel array add() function. In this tutorial we will learn about the Laravel Arr add() method’s syntax and use with example. I’ll show you how to use Laravel Arr add() function with Example.

Laravel Arr::add method

Laravel Arr::add method adds the given $key and $value to an $array if the $key doesn’t already exist within the given $array. If the $key already exists then it will replaces the given $value in a array.

Syntax:-

How to use Laravel Arr::add method

Here, I will give you full example for simply Arr add() method in laravel as bellow.

Example:-

Output:-

In this tutorial we have learn about the Laravel Arr add() function Example and its application with practical example. I hope you will like this tutorial.