I have two variables:
- $foo - client1, client2, client3 (an object array)
- $bar - name, id, turnover (a string array)
If I echo $foo->name
of client 1 it returns successful value, but:
foreach ($foo as $key1 => $value1) {
foreach ($bar as $key2 => $value2) {
echo $value2->$value1; // THIS IS NOT WORKING
}
}
Hope I'm clear; I want to return these values:
client1's name
client1's id
client1's turnover
client2's name
client2's id
etc...
This is successful:
foreach($foo as $client) {
echo $client->name."<br>";
echo $client->id."<br>";
echo $client->billable."<br>";
}
returns client name, his id and if he's billable or not for every client. But the above code is not working. Name, id and billable are stored in a string thus:
$bar = array ([0] => name, [1] => id, [2] => billable )