Help me explain the code $ str (isset ($ _ POST [source])? $ _ POST [source] :); how to understand this sentence. What are the functions of question marks and colons. Please give me some advice. I cannot find any information. The source is from & lt; textareaname & quot; source & quot; & lt; textarea & gt; --- explain the code for me.
$ Str = (isset ($ _ POST ['source'])? $ _ POST ['source']: '');
How can this sentence be understood. What are the functions of question marks and colons. Trouble
Give me some advice. I cannot find any information.
The source is from < textarea>
------ Solution --------------------
Write in this way,
$ Source = $ _ POST ["source"];
$ Str = (isset ($ scource )? $ Scource: null );
If $ source has a value, the value of $ source is assigned to $ str. Otherwise, the value is null for $ str.
Why not?
------ Solution --------------------
A? B: c ternary operators
Equivalent
If (){
Return B;
} Else {
Return c;
}