Re: [PHP] Dynamically creating multi-array field

2008-10-27 Thread Robert Cummings
On Mon, 2008-10-27 at 08:03 -0400, tedd wrote: > At 12:33 AM -0700 10/27/08, Lars Torben Wilson wrote: > >2008/10/27 Martin Zvarík <[EMAIL PROTECTED]>: > >> > >> Hi, I am aware of this, but explaining my problem in this case would take > >> me > >> an hour --- and eventually would lead to a) mis

Re: [PHP] Dynamically creating multi-array field

2008-10-27 Thread Robert Cummings
On Mon, 2008-10-27 at 00:33 -0700, Lars Torben Wilson wrote: > 2008/10/27 Martin Zvarík <[EMAIL PROTECTED]>: > > > > Hi, I am aware of this, but explaining my problem in this case would take me > > an hour --- and eventually would lead to a) misunderstanding, b) weird > > solution, c) no solution..

Re: [PHP] Dynamically creating multi-array field

2008-10-27 Thread tedd
At 12:33 AM -0700 10/27/08, Lars Torben Wilson wrote: 2008/10/27 Martin Zvarík <[EMAIL PROTECTED]>: Hi, I am aware of this, but explaining my problem in this case would take me an hour --- and eventually would lead to a) misunderstanding, b) weird solution, c) no solution... Forgive me if

Re: [PHP] Dynamically creating multi-array field

2008-10-27 Thread Lars Torben Wilson
2008/10/27 Martin Zvarík <[EMAIL PROTECTED]>: > > Hi, I am aware of this, but explaining my problem in this case would take me > an hour --- and eventually would lead to a) misunderstanding, b) weird > solution, c) no solution... Forgive me if I misunderstand, but it seems like you are willing to

Re: [PHP] Dynamically creating multi-array field

2008-10-27 Thread Martin Zvarík
2008/10/26 Martin Zvarík <[EMAIL PROTECTED]>: PHP Version 5.2.4 I really don't like to use the EVAL function, but do I have choice?? This sucks. Hi there, While this question can spur some neat solutions, it raises a red flag in that if you need to do this, you probably need to rethin

Re: [PHP] Dynamically creating multi-array field

2008-10-27 Thread Lars Torben Wilson
2008/10/26 Martin Zvarík <[EMAIL PROTECTED]>: > PHP Version 5.2.4 > > $node = '[5][1][]'; > ${'tpl'.$node} = 'some text'; > > print_r($tpl); // null > ?> > > > I really don't like to use the EVAL function, but do I have choice?? > This sucks. Hi there, While this question can spur some neat solu

Re: [PHP] Dynamically creating multi-array field

2008-10-26 Thread Martin Zvarík
:-D :-D :-D :-D :-D :-D :-D :-D ok :) Robert Cummings napsal(a): On Mon, 2008-10-27 at 02:09 -0400, Robert Cummings wrote: On Sun, 2008-10-26 at 22:39 -0700, Jim Lucas wrote: Even slimmer It's buggy... you need to test for an blank string to properly handle the append to arr

Re: [PHP] Dynamically creating multi-array field

2008-10-26 Thread Robert Cummings
On Mon, 2008-10-27 at 02:09 -0400, Robert Cummings wrote: > On Sun, 2008-10-26 at 22:39 -0700, Jim Lucas wrote: > > > > Even slimmer > > > > > > > $node = '[5][1][]'; > > $text = 'some text'; > > > > preg_match_all('|\[([^\]\[]*)\]|', $node, $matches, > > PREG_PATTERN_ORDER); > > > > $recursiv

Re: [PHP] Dynamically creating multi-array field

2008-10-26 Thread Robert Cummings
On Sun, 2008-10-26 at 22:39 -0700, Jim Lucas wrote: > > Even slimmer > > > $node = '[5][1][]'; > $text = 'some text'; > > preg_match_all('|\[([^\]\[]*)\]|', $node, $matches, > PREG_PATTERN_ORDER); > > $recursive = $matches[1]; > > $recursive = array_reverse($recursive); > > foreach ( $recurs

Re: [PHP] Dynamically creating multi-array field

2008-10-26 Thread Jim Lucas
Jim Lucas wrote: Martin Zvarík wrote: Nope, you have to use the eval() everytime for read/write. Wrong. Their is always more then one way to skin a cat! $text); $out = array(); foreach ( $recursive AS $index ) { $out = array(); $out[(int)$index] = $in; $in = $out; }

Re: [PHP] Dynamically creating multi-array field

2008-10-26 Thread Jim Lucas
Martin Zvarík wrote: Nope, you have to use the eval() everytime for read/write. Wrong. Their is always more then one way to skin a cat! $text); $out = array(); foreach ( $recursive AS $index ) { $out = array(); $out[(int)$index] = $in; $in = $out; } pr

Re: [PHP] Dynamically creating multi-array field

2008-10-26 Thread Martin Zvarík
Nope, you have to use the eval() everytime for read/write. Martin Zvarík napsal(a): No offense, but I thought it's obvious what I want to print. print_r() shows null, and it should print what you just wrote = array field. It works when first defining with eval(): eval('$tpl'.$node.'=array(

Re: [PHP] Dynamically creating multi-array field

2008-10-26 Thread Martin Zvarík
No offense, but I thought it's obvious what I want to print. print_r() shows null, and it should print what you just wrote = array field. It works when first defining with eval(): eval('$tpl'.$node.'=array();'); I guess that's the only way. Anyway, I appreciate your quick reply, Martin Jim L

Re: [PHP] Dynamically creating multi-array field

2008-10-26 Thread Jim Lucas
Martin Zvarík wrote: PHP Version 5.2.4 I really don't like to use the EVAL function, but do I have choice?? This sucks. You should print the results that you are looking for! Are you looking for something like this? Array ( [5] => Array ( [1] => Array

[PHP] Dynamically creating multi-array field

2008-10-26 Thread Martin Zvarík
PHP Version 5.2.4 I really don't like to use the EVAL function, but do I have choice?? This sucks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php