What does this double == do?

I'm editing some code written by someone else.

I trying to figure this statement out:

$tried2 = ($_POST['f_tried2'] == 'yes');

the data being posted (f_tried2) would either be 'yes' or nothing.

I understand that one = assigns a value.  And I have used double == to test equavelency in an 'if' statement.  But does this statement make the value 'yes' if the post has something in it or what?
Who is Participating?
r_bielakConnect With a Mentor Commented:
this code will asign boolean (true or false) to variable $tried2
so if $_POST['f_tried2'] is equal to 'yes' then $tried2 will get value 1 else 0

you can also write
if($_POST['f_tried2']=='yes') $tried2=1; else $tried2=0;
St_Aug_Beach_BumAuthor Commented:
ah, thank you, that helps with the stuff I'm trying to add in, appreciate it.
All Courses

From novice to tech pro — start learning today.