variables - PHP assign first not null, set and not empty value -
i partially solved line above setup variable different others got post method
$myvar= $_post['myvar_a'] ?: $_post['myvar_b'] ?: $_post['myvar'] ?: null;
but need take care of not set , empty value. when not set myvar_a , myvar_b take myvar, otherwise force null because have set in current execution. achieved nested if else pseudo
if isset , !empty myvar = myvar_a else ...
but shorten code. tips?
Comments
Post a Comment