Q:

I've encountered this kind of syntax: var == "" ? "-" : var. Can somebody explain?

The code is this one:
$vendors[] = array(
    "id" => $row['vendorID'],
    "name" => $row['name'] == "" ? "-" : $row['name'],
    "tel1" => $row['phone1'] == "" ? "-" : $row['phone1'],
    "tel2" => $row['phone2'] == "" ? "-" : $row['phone2'],
    "mail" => $row['email'] == "" ? "-" : $row['email'],
    "web" => $row['web'] == "" ? "-" : $row['web']);

Can somebody explain me exactly what it is? Look like an Alternative syntax but I haven't managed to find infos.
Thanks you

A:

This is a ternary operator:

The expression (expr1) ? (expr2) : (expr3) evaluates to expr2 if expr1 evaluates to TRUE, and expr3 if expr1 evaluates to FALSE. 

A:

It means: if value is "" (empty), then set  to "-" (hyphen), else set to whatever it is.
Just read a?b:c as «if a then b else c».

A:

Yes, it is what the others say but it is not really recommended in terms of code readability. Use it with care and don't use it without brackets around the condition.
$myvar = ($condition == TRUE) ? $valueIfTrue : $valueIfFalse;

instead of
if ($condition)
{
    $myvar = $valueIfTrue;
}
else
{
    $myvar = $valueIfFalse;
}

