We've all encountered it before, needing to print a variable in an input field but not knowing for sure whether the var is set, like this. Basically this is to avoid an e_warning.
<input value='<?php if(isset($var)){print($var);}; ?>'>
How can I write this shorter? I'm okay introducing a new function like this:
<input value='<?php printvar('myvar'); ?>'>
But I don't succeed in writing the printvar() function.
echo (isset($var) ? $var : '')
is about as short as you can get and be syntactically correct. – Soapbark