PHP, Shorthand, If..Else using Ternary Operators -


is there oneliner this? nice ternary op?

$f_name = $_session['usr']['f_name']; if(isset($_post['f_name'])) {$f_name = $_post['f_name'];} 

basically "if post sent, show that, if post empty, otherwise grab value session, if post not set or empty"

really splitting hairs here...

looking this:

$f_name = ? ($f_name ? isset($_post['f_name']) : $_session['usr']['f_name']); 

its supposed be:

(conditions) ? true : false    satisfies <--^      ^----> did not satisfy 

so equates into:

$f_name = isset($_post['f_name']) ? $_post['f_name'] : $_session['usr']['f_name'];