php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #60311 Allow multiple arguments instead of array
Submitted: 2011-11-16 10:59 UTC Modified: 2011-11-23 03:03 UTC
From: olafvdspek at gmail dot com Assigned:
Status: Wont fix Package: PostgreSQL related
PHP Version: 5.4.0RC1 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: olafvdspek at gmail dot com
New email:
PHP Version: OS:

 

 [2011-11-16 10:59 UTC] olafvdspek at gmail dot com
Description:
------------
This is a great function, but it could be even simpler. Is it possible to use 
multiple arguments instead of the array? See the test script.

http://php.net/manual/en/function.pg-query-params.php

Test script:
---------------
$result = pg_query_params($dbconn, 'SELECT * FROM shops WHERE name = $1 and age = $2', array("Joe's Widgets", 42));

$result = pg_query_params($dbconn, 'SELECT * FROM shops WHERE name = $1 and age = $2', "Joe's Widgets", 42);



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-23 03:03 UTC] yohgaki@php.net
-Status: Open +Status: Wont fix
 [2011-11-23 03:03 UTC] yohgaki@php.net
I understand your idea, I hate to pass arrays also.
However, PHP 5.4 allows short hand array notation (i.e. []), so you can do it as 
follows.

$result = pg_query_params($dbconn, 'SELECT * FROM shops WHERE name = $1 and age 
= $2', ["Joe's Widgets", 42]);

Just a 2 chars from PHP 5.4! Isn't great?
So I will not implement this.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Nov 25 23:01:24 2020 UTC