Hi,
Il 03/05/2024 17:53, Hans Henrik Bergan ha scritto:
On Fri, 3 May 2024 at 17:49, Derick Rethans <der...@php.net> wrote:
Which *API* in PHP is 1-indexed?
cheers,
Derick
Certainly isn't normal but found 1 (and only 1!):
$stmt = $pdo->prepare('SELECT name FROM users WHERE id = ?');
$stmt->bindParam(1, $id);
I suppose numbering is derived from external (database) standards. E.g.
Postgres uses $1, $2, etc. as parameter placeholders.
Also it is in turn is inconsistent with:
$stmt = $pdo->prepare('SELECT name FROM users WHERE id = ?');
$stmt->execute([$id]);
That said, 0-indexed for the reflection PR seems the best choice to me too.
Cheers
--
Matteo Beccati
Development & Consulting - http://www.beccati.com/