Many times we store our data in array and need to perform some additional function to the array like strtolower, strtoupper, and etc. Before i get to know this handy function, I’ve been searching for the shortest code to perform strtolower to an array in php. Thank god, finally i found array_map function and it solved my many years problem.
To strtolower an array in php, use the code below:-
Advertisements
$myarray = array('XyZ', 'AbC', 'EFG'); $myarray = array_map('strtolower', $myarray);
You may also check out the documentation on array_map
Related posts:
Prestashop 1.5 - How to enable add to cart button at Home Featured Product?
Symfony: How to query using Criteria OR
How to extract img tag attributes using PHP?
How to downgrade to PHP 5.2 using MacPort
Virtue Theme: How to enable slider in shop page?
PHP: How to convert ISO character (HTMLEntities) to UTF-8?
WordPress Plugin Dev: How to send email using SMTP?
Speed Up and Save Your Website Bandwidth with GZip Compression
Share this with your friends:-