tohokuaikiのチラシの裏

技術的ネタとか。

Smartyでは配列のキーにハイフン(-)が入っているとアクセスできない・・・

マジですか!

なんかハマってしまった。

要するに

<?php
$smarty = new Smarty();
$smarty->assign('app', array (
  'hoge-uki' => 123456,
));
$smarty->display('smarty_test.html');

で、
smarty_test.htmlに

{$app.hoge-uki|intval}

ってしても、0って出るんです。

google: smarty 配列 キー ハイフンってしたら
Smarty でキーにハイフンが含まれる連想配列のアクセス方法 - 涅ir槃na
とか出た。あふぅ。脱力。