I have 2 arrays (of different length) that I map together like this:
$mapped_array = array_map(null, array_reverse($data_array), array_reverse($counter_array));
I try to get the count of each array in $mapped_array like this:
echo "Starting with ".count($mapped_array[0])." elements in data_array<br>";
echo "Starting with ".count($mapped_array[1])." elements in counter_array<br><br>";
but the count is 0 - am I referencing the arrays properly?
Then I want to remove elements from both arrays based on a match of a particular IP in each element of $mapped_array[0], which is exploded into an array:
for ( $i=0; $i < count($mapped_array[0]); $i++ )
{
$data_line = $mapped_array[0][$i];
$data = explode("|", $data_line);
if( in_array($ip, $data) )
{
array_splice($mapped_array,$i,1);
}
}
echo "Ending with ".count($mapped_array[0])." elements in data_array<br>";
echo "Ending with ".count($mapped_array[1])." elements in counter_array<br><br>";
This does not work... where am I going wrong?
Thanks in advance