Jump to content

[SOLVED] array strtolower


homer.favenir

Recommended Posts

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

<?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

)

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.