I used this on my local server (XAMPP, latest version):
$num_entries = intval( mysqli_fetch_array( $result )[0] );
which worked fine but after deployment my host's PHP is saying:
Parse error: syntax error, unexpected '[' in /home/aaa/public_html/php/Database.php on line 38
I'm guessing this must be due to some retro-compatability issue.
My host is running PHP 5.3.28.
So what's the most efficient way of fetching an array and getting the first element in a single statement?
mysqli_fetch_object($result)->{0}