I am using Xpath in PHP - I know that my query will return either 0 or 1 results.
If 1 result is returned I do not want it as an array - which is what is returned ri
You can write it most simply like this:
$string = @$array[0];
The @ operator will suppress errors, making $string null if $array is empty.
$string
$array