How to convert array values to lowercase in PHP?By Hardik Savani | April 5, 2016 | | 622 Viewer | Category : PHP
Share this post:
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
- How to create and use Middleware in Laravel 5?
- How to upgrade node.js version in Ubuntu?
- PHP - jquery ajax crop image before upload using croppie plugin
- How to set scroll to bottom in jquery?
- Laravel 5.2 multi auth example using Auth guard from scratch
- How to change view mode in bootstrap datepicker like yyyy-mm?
- Jquery - How to copy text to clipboard without flash example ?
- Laravel 5 amazon s3 file upload tutorial - Part 1