Код: Выделить всё
//C# code
public class TermsCommodityModel
{
public int terms_id { get; set; }
public int commodity_id { get; set; }
public int custom { get; set; }
public int calculated { get; set; }
public string name { get; set; }
public string formula { get; set; }
public int division_id { get; set; }
}
Код: Выделить всё
//PHP code
if (!isset($termsTable[$name]))
$termsTable[$name] = array();
< /code>
Я подумал, что это странно, но выполнимо. Затем второе условие создало еще один массив ребенка, и он продолжался. Теперь код PHP выглядит так, < /p>
//PHP Code
if (!isset($termsTable[$name][$t->commodity_id]))
$termsTable[$name][$t->commodity_id] = array();
//.Omitted for brevity
//....
$year = date("Y") + 5;
for ($y = 2008; $ycommodity_id][$y] = array();
for ($i=1; $icommodity_id][$y][$i] = 0;
}
< /code>
Это окончательная структура данных < /p>
//PHP Code
$termsTable[$name]
$termsTable[$name][$t->commodity_id]
$termsTable[$name][$t->commodity_id][$y]
$termsTable[$name][$t->commodity_id][$y][$i]
< /code>
Это по существу создало массив массива массива массива объекта динамически. Дело в том, что PHP - динамически напечатанный язык. Не нужно указывать тип < /p>
Какая структура данных в C# может сделать это? Я не могу использовать кортеж Подробнее здесь: https://stackoverflow.com/questions/475 ... ion-of-php
Мобильная версия