I want to get a other property of a associative array when the first one doesn't exist.
JavaScript:
var obj = {"a": "123", "b": "456"};
var test = obj.a || obj.b;
console.log(test);
Is it possible to do this in PHP:
$arr = array("a" => "123", "b" => "456");
$test = $arr["a"] || $arr["b"];
echo $test;
When I run the PHP, I get 1.
Is there any short way I could do it?