array_diff()?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



*accidentally sent*

Guys,

Perhaps I'm missing something or just trying with the wrong tools...

But the thing is, I have two arrays and want to know what values are in one
that aren't in the other.

They're very long arrays (label files for translation) and the array_diff()
is returning null, even if I force a difference.

What's up?

<?php
$file1 = 'label_es.ini';
$file2 = 'label_pt.ini';

$fh1 = fopen ($file1,'r');
$fh2 = fopen ($file2,'r');

$file1 = array();
$file2 = array();

while (($line = fgets($fh1))) {
    $label = explode("=",$line);
    $array1[] = $label[0];
}

while (($line = fgets($fh2))) {
  $label = explode("=",$line);
  $array2[] = $label[0];
}


$missingLabels= array_diff($array1,$array2);


var_dump($labelsFaltantes); // returns nothing
var_dump($array1); // returns a lot of stuff
var_dump($array2); // returns a lot of stuff
?>

-- 
Thiago Henrique Pojda

-- 
Thiago Henrique Pojda

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux