Re: Dynamically creating multi-array field

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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();');

I guess that's the only way.

Anyway, I appreciate your quick reply,
Martin


Jim Lucas napsal(a):
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 this?

Array
(
    [5] => Array
        (
            [1] => Array
                (
                    [0] => some text
                )

        )

)

how is the $node string being created?



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux