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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC