How to convert array values to lowercase in PHP?By Hardik Savani | April 5, 2016 | | 691 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
- PHP - Input multiple tags with dynamic autocomplete example
- How to remove white space from string in PHP?
- How to get ip address in jquery?
- How can i get the path from laravel application root?
- How to calculate age from date of birth column in mysql?
- How to upgrade node.js version in Ubuntu?
- Laravel 5.3 - Form Input Validation rules example with demo
- Simple accordion example code with demo using jquery ui