How to remove key from array in Laravel 5?By Hardik Savani | July 7, 2016 | | 5005 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']);
- Paytm payment gateway integration example in Laravel 5
- How to resolve - No supported encrypter found. The cipher and / or key length are invalid. in Laravel 5
- Laravel - How to search with comma separated values using Query Builder ?
- How to define Global Variables in Laravel 5?
- Laravel 5 - Multiple markers in google map using gmaps.js
- AngularJS - How to render HTML value in ng-repeat ?
- Angularjs nl2br(textarea newline and linebreak conversion) example with demo
- AngularJS - Display Default image if original image does not exists with example