Creating multidimensional array

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

 



Hi all,

I got a problem with creating a multidimensional array which it's size is
unknown.
I already made it work like this (example):
<?php
$array = array('six','five','four','three','two','one');

for ($i = count($array)-1; $i >= 0; $i--) {
 $array_keys_string_representation .= '["'.$array[$i].'"]';
}

eval('$new_array'.$array_keys_string_representation.'["node_title"] =
"string value";');
?>

The problem is that I don't like using eval() cause it's slow &
insecure.....

I want to do something like this (doesn't work):
<?php
$array = array('six','five','four','three','two','one');

for ($i = count($array)-1; $i >= 0; $i--) {
 $array_keys_string_representation .= '["'.$array[$i].'"]';
}

$new_array.$array_keys_string_representation.'["node_title"] = "string
value";
?>

Anyone got any idea how can I build such an array without eval()?

Thanks a lot in advance,
 Ben-Nes Yonatan

[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