I have a post php form and a set of inputs:
Every input looks the same, only the names change
You could use my tiny library ValueResolver in this case, for example:
$default = ValueResolver::resolve(get_option('your_name'), '');
and don't forget to use namespace use LapaLabs\ValueResolver\Resolver\ValueResolver;
There are also ability to typecasting, for example if your variable's value should be integer, so use this:
$id = ValueResolver::toInteger('6 apples', 1); // returns 6
$id = ValueResolver::toInteger('There are no apples', 1); // returns 1 (used default value)
Check the docs for more examples