I have a method that someone helped me with. Not sure what it means

echo    ( $info['Ans_Answer'.$i]) ? " checked" : "";

Why not ask them then? If they "helped", they should be able to tell you quite easily what it is and why they did it that way.

well it was ages ago. I have to spend time looking for the thread. and I though someone out there might just know.

only part I dont get it

? " checked" : "";
Member Avatar for diafol

It's a ternery operator - shorthand for if/else.

echo ( $info['Ans_Answer'.$i]) ? " checked" : "";

Is short for:

if($info['Ans_Answer'.$i]){
  echo " checked";
}else{
  echo "";
}

Thank you. Thats all I needed to know..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.