Re: Inconsistencies between parameter number and index when reflecting a method/function

From: Date: Fri, 03 May 2024 18:46:59 +0000
Subject: Re: Inconsistencies between parameter number and index when reflecting a method/function
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-123266@lists.php.net to get a copy of this message
Hi, Il 03/05/2024 17:53, Hans Henrik Bergan ha scritto:
On Fri, 3 May 2024 at 17:49, Derick Rethans <derick@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/

« previous php.internals (#123266) next »