How to remove key from array in Laravel 5?By Hardik Savani | July 7, 2016 | | 9876 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 solve 'There are no commands defined in the "cashier" namespace' in Laravel 5
- How to quick run any PHP Project?
- Laravel 5 - Paypal Payment Integration example using netshell/paypal package from scratch
- How to hide div after some time using AngularJS?
- How to find day from specific date in PHP?
- Laravel 5.3 new feature and update - $loop variable
- How to prevent submit form on enter key except textarea in JQuery?
- How to get table name from model in Laravel 5?