Re: substr/array_slice in []
| From: | Emil Hernvall | Date: | Sun, 07 Oct 2007 23:39:51 +0000 |
| Subject: | Re: substr/array_slice in [] | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-32691@lists.php.net to get a copy of this message | ||
On a related note. Code like:
$foo = array("a" => range(1,10), "b" => range(11,20));
print_r($foo[][0]);
results in
Fatal error: Cannot use [] for reading in Command line code on line 3
It would be incredibly useful when handling regular two-dimensional
database-resultsets. Essentially, what I'm after is things like this:
$result = $pdo->fetchAll(PDO::FETCH_ASSOC);
$result = array_combine(result[]['my_id'], $result);
If I prepared a patch that made this possible, would it be considered
for inclusion? Is there any issues I've overlooked or other
objections?