How to remove key from array in Laravel 5?By Hardik Savani | July 7, 2016 | | 1188 Viewer | Category : Laravel
Share this post:
Sometimes, we require to delete specific key from array like we have password and confirm-password field but we don't require to store confirm-password field we have to drop that key from input array, At that time we always use unset() function of PHP pre-define.
But if you work on laravel then you can array helper function. we can remove multiple key from variable using array_except() of Laravel pre-define function. In bellow example you can understand very well.
$myArray = ['name'=>'HD','email'=>'firstname.lastname@example.org','password'=>'123456','confirm-password'=>'123456'];
$myArray = array_except($myArray,['confirm-password']);
- How to get latitude longitude from mysql in laravel 5?
- Laravel 5.3 - Create Bootstrap Contact US Form using Form Request
- How to integrate google map using gmaps.js in php example?
- PHP download file from url using curl example
- Example of Cron Job in Laravel 5
- How to remove query string from URL using JQuery
- Bootstrap progress bar animate example using bootstrap-progressbar.js
- How to check if record exists or not in Laravel 5?