Today now in this post i would like to share with you How to convert array values to lowercase in PHP. Whenever we need to create all the array value in lowercase then we can create that without using any loop. we need to just use array_map(), array_map function take two arguments one of them for php function “strtolower” and the second one for array. So it may be we need to do this when we are working on any big projects and we need to all values in the small case.
So, here you will know how to convert array values to lowercase by using array_map().
Let’s see the bellow example and learn how it’s work.
$myArray = ['1'=>'Hey','2'=>'Hello','3'=>'Hi','4'=>'GM']; $result = array_map('strtolower',$myArray); print_r($result);
Read Also : How to convert Object into Array in PHP?
Thanks for read. I hope it help you. For more you can follow us on facebook.