Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #5078
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | "M. Strobel" <sorry_no_mail_here@nowhere.dee> |
| Newsgroups | comp.lang.php |
| Subject | Re: string to array |
| Date | Fri, 02 Mar 2012 18:09:37 +0100 |
| Lines | 36 |
| Message-ID | <9rcd6hF45cU1@mid.uni-berlin.de> (permalink) |
| References | <9rbvjcFo5nU1@mid.uni-berlin.de> <503439d4-1cd3-4d6c-a010-5766b540aa13@l14g2000vbe.googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.uni-berlin.de 3NobHLAA65UANR0CeqjLYw1ZcyaHUc9nuENKVpshhuu+CQTyw= |
| User-Agent | Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.27) Gecko/20120215 Thunderbird/3.1.19 |
| In-Reply-To | <503439d4-1cd3-4d6c-a010-5766b540aa13@l14g2000vbe.googlegroups.com> |
| Xref | csiph.com comp.lang.php:5078 |
Show key headers only | View raw
Am 02.03.2012 15:02, schrieb Captain Paralytic:
> On Mar 2, 1:17 pm, "M. Strobel" <sorry_no_mail_h...@nowhere.dee>
> wrote:
>> Hi,
>>
>> I am just testing with hstore in postgresql, this is a datatype providing a
>> key-value-store in one column (http://www.postgresql.org/docs/9.1/static/hstore.html).
>>
>> The php question is:
>>
>> A select from the table looks like this:
>>
>> trans1=> select * from testh;
>> Tabelle testh
>> n | h
>> ---------+-------------------------------------------------------------
>> Michael | "age"=>"89", "weight"=>"91", "haircolor"=>"braun"
>> Peter | "weight"=>"82", "haircolor"=>"rot", "has spaces"=>"is true"
>> (2 Zeilen)
>>
>> And a select gives me the h column back as a string:
>>
>> array(2) {
>> ["n"]=>
>> string(5) "Peter"
>> ["h"]=>
>> string(59) ""weight"=>"82", "haircolor"=>"rot", "has spaces"=>"is true""
>>
>> This looks like php source code. How could I just eval it to get a php array?
>>
>> /Str.
>
> At a guess
> eval("\$harray=array({$result['h']});");
>
Yeah!
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
string to array "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-03-02 14:17 +0100
Re: string to array Captain Paralytic <paul_lautman@yahoo.com> - 2012-03-02 06:02 -0800
Re: string to array "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-03-02 18:09 +0100
Re: string to array Jerry Stuckle <jstucklex@attglobal.net> - 2012-03-02 13:07 -0500
Re: string to array Jerry Stuckle <jstucklex@attglobal.net> - 2012-03-02 09:46 -0500
Re: string to array "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-03-02 18:03 +0100
Re: string to array Jerry Stuckle <jstucklex@attglobal.net> - 2012-03-02 13:09 -0500
Re: string to array "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-03-02 19:38 +0100
Re: string to array Jerry Stuckle <jstucklex@attglobal.net> - 2012-03-02 14:49 -0500
Re: string to array "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-03-02 18:37 +0100
csiph-web