Problems with unique arrays

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… :frowning:
Also, I´d like to COUNT all the unique values.

Output example:

Array ( [0] => 007271015xx ) Array ( [0] => 007352190xx ) Array ( [0] => 007271015xx )

Thanks in advance!

The output you’ve pasted seem to be only unique values…

Please add a sample of:
input array
expected output array
and what you are actually getting

Here´s how the full output looks like.
And I want it to show only the unique values, and also count them.

As you can see below many of the numbers are on multiple rows.

I need it for a report where I want to see how many customers that are calling us back at my work.

Thanks alot!

Array ( [0] => 00455688822 ) Array ( [0] => 0032174089 ) Array ( [0] => 0032174089 ) Array ( [0] => 00500495812 ) Array ( [0] => 00515723513 ) Array ( [0] => 00707963052 ) Array ( [0] => 0051125365 ) Array ( [0] => 00104764109 ) Array ( [0] => 00547756666 ) Array ( [0] => 00707963052 ) Array ( [0] => 00707963052 ) Array ( [0] => 00104752089 ) Array ( [0] => 00104725507 ) Array ( [0] => 00812012441 ) Array ( [0] => 00812012441 ) Array ( [0] => 00102181157 ) Array ( [0] => 0050116356 ) Array ( [0] => 0050648811 ) Array ( [0] => 00500464311 ) Array ( [0] => 00706821829 ) Array ( [0] => 00510488450 ) Array ( [0] => 00500200157 ) Array ( [0] => 00510488450 ) Array ( [0] => 00706055760 ) Array ( [0] => 00737196778 ) Array ( [0] => 00722254014 ) Array ( [0] => 00471249225 )

Bump! Help appreciated! :slight_smile:

Bump! Merry christmas :slight_smile:

Sponsor our Newsletter | Privacy Policy | Terms of Service