I am developing a loop to compare two tables in a database. The intention is to know how many people were indicated by a same employee of the company. For this, I need to start an array as follows:
foreach($linhas as $linha){
$varivael = array( $linha['nome'] => 0);
};
The problem is that this only adds the last item in the table, and I want them all to be inserted, which looks like this:
$varivael = array( $linha['nome'] => 0, $linha['nome'] => 0, $linha['nome'] => 0, ...);
I thought about using array_push (), but it only inserts the element, not the index.
How to proceed?