lundi 21 août 2017

Wrong foreach with a value

I have a question: I have an array with a field 'type_record'.There is in the same array also a field 'text' The results in that particular field can be A, B or C A is Advise (text) B is Boo (negative advise) (text) C is General comment (text)

What I am trying to do is to make a function where I only get text as an output if the type_input is A. So if the type input is B or C I do not want a result. I will make different functions for B and C.

What I have:

function getAdvise($bw_data) {

$return = "<ul>";
foreach($bw_data as $bw["type_input" =['A']]) {

  $return .= $bw["text"];
 }
 $return .= "</ul>";

 return($return);
}

Well, this is not working, do you have a solution?

Aucun commentaire:

Enregistrer un commentaire