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 Quote Link to comment 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); Quote Link to comment 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 ) Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.