i have an array $t1 like below :
Array (
[0] => Array (
[cust_type] => Corporate
[trx] => 1
[amount] => 10 )
[1] => Array (
[cust_type] => Non Corporate
[trx] => 2
[amount] => 20 )
[2] => Array (
[cust_type] => Corporate
[trx] => 3
[amount] => 30 )
[3] => Array (
[cust_type] => Non Corporate
[trx] => 4
[amount] => 40 ))
I want to print TRX whose cust_type = Corporate. I use conditional statement inside foreach as below :
foreach ($t1 as $key => $value) {
if($value['cust_type'] = 'Corporate')
{
print_r($value['trx']);
}
echo "<br/>";
}
But it prints all TRX values instead of corporate only. Kindly help me, thank you.