Login with PHP using PDO [duplicate]

1

I already know how to make registrations, however login is a bit complicated for me. I found some materials on the internet and I would like to know what the following line does. I know I'm collecting information from the form, I wanted to know what specifically makes " ? $_POST['password'] : ''; " that part of the line on.

// resgata variáveis do formulário
$email = isset($_POST['email']) ? $_POST['email'] : '';
$password = isset($_POST['password']) ? $_POST['password'] : '';
    
asked by anonymous 06.12.2016 / 14:34

1 answer

2

This is what we call a% tero%. What comes after the assignment ( if ) and before = is a condition for assigning what comes before or after ? .

? == if
: == else

In a practical example you can have:

$minha_variavel = $se_aqui_for_verdadeiro ? $isso : $se_nao_isso;
    
06.12.2016 / 14:41