I'm using a shorthand if statement to validate if a value is assigned to a variable, my question is should I assign the statement to a variable, because it's working if I assigned it or not.
statement not assigned to variable | working
!empty($name) ? $name : $name="";
statement assigned to variable | also working
$is_name = (!empty($name)) ? $name : $name="" ;
Both statements are working, but which one is correct or better to be used.
this may be better. you don't need a extra ! operaiton and variable assignment.
or