Why does this code work:
$row = $stmt->fetch();
$result = array("status"=>"0", "uid"=>($row["id"]));
And this one does not:
$result = array("status"=>"0", "uid"=>(($stmt->fetch())["id"]));
Why does this code work:
$row = $stmt->fetch();
$result = array("status"=>"0", "uid"=>($row["id"]));
And this one does not:
$result = array("status"=>"0", "uid"=>(($stmt->fetch())["id"]));
Since PHP 5.4 it's possible to do what you did.
getSomeArray()[$someKey]
Reference: http://php.net/manual/en/language.types.array.php#example-88
Prior to PHP 5.3, you'll need to use a temporary variable.