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
Have you experienced this issue?
Rate the importance of this bug to you:

 [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-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 00:01:27 2024 UTC