I have some kind of specific problem. I have multidimensional array which looks like:
array(2) {
[0]=>
array(6) {
[0]=>
array(9) {
["id"]=>
int(9997)
["project_id"]=>
int(327)
["projectType_id"]=>
int(1)
["parameter"]=>
string(11) "Web Server?"
["description"]=>
NULL
["severity"]=>
string(1) "1"
}
[1]=>
array(9) {
["id"]=>
int(9998)
["project_id"]=>
int(327)
["projectType_id"]=>
int(1)
["parameter"]=>
string(7) "Server?"
["description"]=>
NULL
["severity"]=>
string(1) "2"
}
[2]=>
array(9) {
["id"]=>
int(9999)
["project_id"]=>
int(327)
["projectType_id"]=>
int(1)
["parameter"]=>
string(7) "Server?"
["description"]=>
NULL
["severity"]=>
string(1) "3"
}
[3]=>
array(9) {
["id"]=>
int(10000)
["project_id"]=>
int(327)
["projectType_id"]=>
int(1)
["parameter"]=>
string(7) "Server?"
["description"]=>
NULL
["severity"]=>
string(1) "2"
}
[4]=>
array(9) {
["id"]=>
int(10001)
["project_id"]=>
int(327)
["projectType_id"]=>
int(1)
["parameter"]=>
string(7) "Server?"
["description"]=>
NULL
["severity"]=>
string(1) "2"
}
[5]=>
array(9) {
["id"]=>
int(10002)
["project_id"]=>
int(327)
["projectType_id"]=>
int(1)
["parameter"]=>
string(11) "Web Server?"
["description"]=>
NULL
["severity"]=>
string(1) "2"
}
}
[1]=>
array(5) {
[0]=>
array(9) {
["id"]=>
int(8828)
["project_id"]=>
int(298)
["projectType_id"]=>
int(1)
["parameter"]=>
string(11) "Web Server?"
["description"]=>
NULL
["severity"]=>
string(1) "1"
}
[1]=>
array(9) {
["id"]=>
int(8829)
["project_id"]=>
int(298)
["projectType_id"]=>
int(1)
["parameter"]=>
string(7) "Server?"
["description"]=>
NULL
["severity"]=>
string(1) "3"
}
[2]=>
array(9) {
["id"]=>
int(8830)
["project_id"]=>
int(298)
["projectType_id"]=>
int(1)
["parameter"]=>
string(7) "Server?"
["description"]=>
NULL
["severity"]=>
string(1) "2"
}
[3]=>
array(9) {
["id"]=>
int(8831)
["project_id"]=>
int(298)
["projectType_id"]=>
int(1)
["parameter"]=>
string(7) "Server?"
["description"]=>
NULL
["severity"]=>
string(1) "2"
}
[4]=>
array(9) {
["id"]=>
int(8832)
["project_id"]=>
int(298)
["projectType_id"]=>
int(1)
["parameter"]=>
string(11) "Web Server?"
["description"]=>
NULL
["severity"]=>
string(1) "2"
}
}
}
What I would like to do is to knew about differences between those tables. I mean how many rows are present in table 1 and are absent in table 2. How many rows are absent in table 1 and present in table 2 and how many rows are equals in both tables.
I tried with creating loops over array checking each row and comparing it. My code is posted bellow. It got me nowhere..
foreach ($bigArray[0] as $new){
foreach($bigArray[1] as $old){
if ($new== $old)
echo "it is the same";
else
echo "it is different";
}
}
All I got is it is different all time...
Is there any function to count this kind of stuff? (first column -ID is unique for each row so it should not have been taken into consideration.