When I check for a return value of a function I usually do this:
$my_value = get_field('some_field');
$my_value = $my_value ? $my_value : get_field('backup');
In Javascript I usually use or
(||
) to check a value and if not return an alternative i.e.
var my_value = get_field('some_field') || get_field('backup');
Is there something equivalent in php
?
Even faster:
$my_value = get_field('some_field') ?: get_field('backup');
Note that it tests if get_field('some_field')
is true or false, and if true, return its value, else get_field('backup')
...