I find myself creating redundant variables in PHP when querying the database.
In Javascript, C# and Java I'm able to directly use an array index operator after a method call, where as in PHP, I can't.
The following example illustrates my point:
// $result -> SELECT t.id
// FROM table t
// WHERE t.name = 'bla'
// LIMIT 1
$o = mysql_fetch_assoc($result);
$value = $o['valueIndex'];
And this would be invalid:
$value = mysql_fetch_assoc($result)['valueIndex'];
Why is the above invalid, did they do this by design? Or would the grammar get too complicated?
Little fiddle over here.