Req #80844 [Nab->Opn]: Support assoc/num/both for mysqli_result iterated arrays
| From: | requinix@php.net | Date: | Mon, 08 Mar 2021 16:41:52 +0000 |
| Subject: | Req #80844 [Nab->Opn]: Support assoc/num/both for mysqli_result iterated arrays | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-232629@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80844&edit=1
ID: 80844
Updated by: requinix@php.net
Reported by: olafvdspek at gmail dot com
-Summary: Array destructuring for mysqli_result
+Summary: Support assoc/num/both for mysqli_result iterated
arrays
-Status: Not a bug
+Status: Open
Type: Feature/Change Request
Package: MySQLi related
Operating System: *
PHP Version: Irrelevant
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2021-03-08 16:18:44] olafvdspek at gmail dot com
If the potential incompatibility is a problem you could add a flag to the query function, indicating
what the iterator should return.
------------------------------------------------------------------------
[2021-03-08 16:15:28] olafvdspek at gmail dot com
I like code to be as simple as possible, having to repeat the code is less simple than is possible..
The inconsistency with PDO seems weird too.
------------------------------------------------------------------------
[2021-03-08 15:26:25] requinix@php.net
Making the iterator return a different kind of array would be a breaking change for code that thinks
the array is purely associative.
Is it really such a problem to destructure with keys?
------------------------------------------------------------------------
[2021-03-08 14:14:56] olafvdspek at gmail dot com
I know.. hence my feature request (to support destructuring without keys).
------------------------------------------------------------------------
[2021-03-08 13:43:57] requinix@php.net
As you can see, the value given through the iterator is an array that contains only associative
string keys, not also numeric keys. It can be destructured - if you specify the keys.
...as ["uid" => $uid, "name" => $name]
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=80844
--
Edit this bug report at https://bugs.php.net/bug.php?id=80844&edit=1