How to remove key from array in Laravel 5?By Hardik Savani | July 7, 2016 | | 7188 Viewer | Category : Laravel
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 send mail using mailable in laravel 5.3?
- Laravel 5 - Example of Database Seeder with insert sample data
- PHP - Infinite Scroll Pagination using JQuery Ajax Example
- Laravel 5 - Dynamic Dependant Select Box using JQuery Ajax Example - Part 2
- AngularJS - How to create read more/less toggle using Directive?
- How to create middleware for XSS protection in laravel 5?
- How to create custom helper in Laravel 5?
- How to set vertical align middle div by CSS in HTML?