I've got an array of this kind:
Array ( 
[0] => Array (  [attribute_group_id] => 1
                [name] => Name 1 
                [attribute] => Array (  [0] => Array ( 
                                            [attribute_id] => 1 
                                            [name] => Attribute 1
                                            [text] => AAA) 
                                        [1] => Array ( 
                                            [attribute_id] => 2 
                                            [name] => Attribute 2 
                                            [text] => BBB ) 
                                        [2] => Array ( 
                                            [attribute_id] => 3 
                                            [name] => Attribute 3 
                                            [text] => CCC ) 
                                        ) ) )
I would like to extract only BBB text here, but if I construct the foreach function it outputs something like BBB BBB BBB (example below):
foreach ($p_atts as $p_att) {
  foreach ($p_att['attribute'] as $attribute) {
    if ($attribute['attribute_id'] = '2') {
       $out .= $attribute['text'];
    }
  }
}
I would be glad if you could help!
 
    