Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:15447 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83721 invoked by uid 1010); 15 Mar 2005 01:46:51 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 83684 invoked from network); 15 Mar 2005 01:46:50 -0000 Received: from unknown (HELO davyandbeth.com) (127.0.0.1) by localhost with SMTP; 15 Mar 2005 01:46:50 -0000 X-Host-Fingerprint: 66.198.51.121 lerdorf.com Linux 2.4/2.6 Received: from ([66.198.51.121:51119] helo=colo.lerdorf.com) by pb1.pair.com (ecelerity HEAD r(5124)) with SMTP id 1F/F9-31540-98E36324 for ; Mon, 14 Mar 2005 20:46:49 -0500 Received: from [192.168.2.106] (c-24-6-1-160.client.comcast.net [24.6.1.160]) (authenticated bits=0) by colo.lerdorf.com (8.13.3/8.13.3/Debian-8) with ESMTP id j2F1kaiI024885 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 14 Mar 2005 17:46:36 -0800 Message-ID: <42363E79.6000704@lerdorf.com> Date: Mon, 14 Mar 2005 17:46:33 -0800 User-Agent: Mozilla Thunderbird 1.0 (Macintosh/20050217) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Christopher Kings-Lynne CC: php-dev References: <42363E35.3010705@familyhealth.com.au> In-Reply-To: <42363E35.3010705@familyhealth.com.au> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] PHP array to char ** From: rasmus@lerdorf.com (Rasmus Lerdorf) Christopher Kings-Lynne wrote: > Hi, > > I'm working on some improvements to the pgsql extension and I would like > to know how to convert a zval* that points to a PHP array to a char** > that I can pass to the pgsql API functions. The API function takes > const char** so it will not modify the string, but the string must exist > for the duration of the API call... > > I've been looking at other code that does similar things, but I can't > help wondering if there is a simple, straightforward way of doing it? Just look at ext/standard/array.c There are dozens of examples of how to walk a HashTable in there. -Rasmus