I have 2 arrays that come from 2 different banks, one comes from the sql server another from mysql.
Mysl query returns like this ..
array (size=6)
0 => string 'ultimoteste3' (length=12)
1 => string 'ultimoteste3' (length=12)
2 => string 'Rodrigues' (length=9)
3 => string '[email protected]' (length=24)
4 => string '2' (length=1)
5 => string 'Teste Curso' (length=11)
Now the query of the sql server that is a Procedure returns like this:
array (size=16)
'username' => string 'username' (length=8)
0 => string 'username' (length=8)
'firstname' => string 'firstname' (length=9)
1 => string 'firstname' (length=9)
'lastname' => string 'lastname' (length=8)
2 => string 'lastname' (length=8)
'email' => string 'email' (length=5)
3 => string 'email' (length=5)
'lang' => string 'lang' (length=4)
4 => string 'lang' (length=4)
'course1' => string 'course1' (length=7)
5 => string 'course1' (length=7)
'type1' => string 'type1' (length=5)
6 => string 'type1' (length=5)
'auth' => string 'auth' (length=4)
7 => string 'auth' (length=4)
How much I use
print_r(array_diff($lista1, $lista2));
The result comes like this ...
Array ( )
I need to go through the two arrays and find out which users are in one and not another, to bring the difference between the arrays ...
To save the values of each one I did so
mysql = $lista1 = mysqli_fetch_all($result);
sqlServer = $lista2 = $consulta->fetchAll(); (pq uso PDO);