homer.favenir Posted October 30, 2008 Share Posted October 30, 2008 hi, can anyone please help me how to change the case of an array to lower. my script is <?php $a = array(cot01,COT02,cot03); $b = array(cot01,COT02,COT03); $diff = array_diff($a, $b); $diff2 = array_diff($b, $a); $union = array_merge($diff,$diff2); print_r($union); ?> i want to strtolower the $a and $b, when i compare them the uppercase is different from lowercase eventhough they have the same word thanks Link to comment https://forums.phpfreaks.com/topic/130695-solved-array-strtolower/ Share on other sites More sharing options...
JasonLewis Posted October 30, 2008 Share Posted October 30, 2008 $a = array_map('strtolower', $a); $b = array_map('strtolower', $b); Link to comment https://forums.phpfreaks.com/topic/130695-solved-array-strtolower/#findComment-678231 Share on other sites More sharing options...
redarrow Posted October 30, 2008 Share Posted October 30, 2008 <?php $a = array(cot01,COT02,cot03); $b = array(cot01,COT02,COT03); $a = array_map('strtolower', $a); $b = array_map('strtolower', $b); $a=array_diff($a,$b); $union = array_merge($a,$b); print_r($union); ?> array array_map ( callback $callback , array $arr1 [, array $... ] ) array_map() returns an array containing all the elements of arr1 after applying the callback function to each one. The number of parameters that the callback function accepts should match the number of arrays passed to the array_map() Array ( [0] => cot01 [1] => cot02 [2] => cot03 ) Link to comment https://forums.phpfreaks.com/topic/130695-solved-array-strtolower/#findComment-678236 Share on other sites More sharing options...
homer.favenir Posted October 30, 2008 Author Share Posted October 30, 2008 thanks, you guys were a big help I didnt know that, maybe because i didnt explore array function too much. Link to comment https://forums.phpfreaks.com/topic/130695-solved-array-strtolower/#findComment-678238 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.