Re: [PHP] Dynamically creating multi-array field

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

Re: [PHP] Dynamically creating multi-array field

2008-10-27 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 ?php $node = '[5][1][]'; $text = 'some text'; preg_match_all('|\[([^\]\[]*)\]|', $node, $matches, PREG_PATTERN_ORDER); $recursive = $matches[1];

Re: [PHP] Dynamically creating multi-array field

2008-10-27 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 ?php $node = '[5][1][]'; $text = 'some text'; preg_match_all('|\[([^\]\[]*)\]|', $node,

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 solutions, it

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 ? $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 solutions, it

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 trade

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 I

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 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) misunderstanding,

[PHP] Dynamically creating multi-array field

2008-10-26 Thread Martin Zvarík
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. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Dynamically creating multi-array field

2008-10-26 Thread Jim Lucas
Martin Zvarík wrote: 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. You should print the results that you are looking for! Are you looking for something like

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

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():

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! ?php $node = '[5][1][]'; $text = 'some text'; preg_match_all('|\[([^\]\[]*)\]|', $node, $matches, PREG_PATTERN_ORDER); $recursive = $matches[1];

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! ?php $node = '[5][1][]'; $text = 'some text'; preg_match_all('|\[([^\]\[]*)\]|', $node, $matches, PREG_PATTERN_ORDER); $recursive =