0

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

echo    ( $info['Ans_Answer'.$i]) ? " checked" : "";
3
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by xxreenaxx1
0

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.

0

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" : "";
0

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 "";
}

Edited by diafol: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.