How to convert array values to lowercase in PHP?By Hardik Savani | April 5, 2016 | | 909 Viewer | Category : PHP
Whenever you require to create all array value in lowercase then you can create that without using loop. you have to just use array_map(), array_map function take two argument one for php function "strtolower" and second one for array. May be we need to do this when we are working on big projects and need to all values in small case.
So, how to convert array values to lowercase using array_map(), see bellow example and learn how to work.
$myArray = ['1'=>'Hey','2'=>'Hello','3'=>'Hi','4'=>'GM'];
$result = array_map('strtolower',$myArray);
 => hey
 => hello
 => hi
 => gm
- PHP - Input multiple tags with dynamic autocomplete example
- How to create quick apache virtual host in Ubuntu?
- Laravel 5 select with count query with group by example
- How to create Event for Mail sending in Laravel 5.2?
- Laravel 5 email verification with activation code example
- How to create scroll to top of the page by jquery animate ?
- CRUD (Create Read Update Delete) Example in Laravel 5.2 from Scratch
- Crop, Resize, Frames etc on selected image in php using Aviary