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

Popular posts from this blog

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Using jquery append to add option values into a select element not working -

javascript - Restarting Supervisor and effect on FlaskSocketIO -