Hey there!
I´ve been searching around for a solution to filter out only the unique values from an array.
I´m not very familiar with how arrays work and I just can´t get it to work properly…
Here´s my current code:
[php]<?php
$data2 = $conn->query(“CALL informix.sp_call_csq_agent (’” . $datefrom . " 00:00:00’, ‘" . $dateto . " 22:00:00’, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1, -1 )");
foreach($data2 as $row2) {
$string = ($row2[‘7’]);
$arr1 = explode( PHP_EOL, $string );
$uniqueArray = array_unique($arr1, SORT_REGULAR);
print_r($arr1);
echo “
”;
}
?>[/php]
This code still doesn´t print out the unique values, it prints out every value that exists…
Also, I´d like to COUNT all the unique values.
Output example:
Array ( [0] => 007271015xx )
Array ( [0] => 007352190xx )
Array ( [0] => 007271015xx )
Thanks in advance!