How to remove key from array in Laravel 5?By Hardik Savani | July 7, 2016 | | 4023 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 keys name from array using array helper in PHP Laravel ?
- How to install laravel in your Android Phone
- How to uninstall cordova and ionic in ubuntu
- Jquery - How to copy text to clipboard without flash example ?
- How to resolve laravel 5 blank page on server?
- How to select concat columns with Laravel Query Builder?
- Crop, Resize, Frames etc on selected image in php using Aviary
- How to use elasticsearch from scratch in laravel 5?