Short form or Ternary operator is often used in many server and client side languages. The syntax of operator is usually same. I am going to give an example of PHP.
You are going to use an if condition in your PHP like
if ($country=="us")
$language = "us english";
else
$language = "uk english";
You may ternary oeprator to do same operation in short form; use following line of code
$language = ($country=="us")?"us english":"uk english";
is it cool ... isn't it :)
0 comments:
Post a Comment
comment or ask