开发者

how to check foreach index is integer or string in smarty?

how to check foreach index is integer or string in smarty?

<?php
$arr = array(9 => 'Tennis', 3 =开发者_JAVA百科> 'Swimming', 8 => 'Coding');
$smarty->assign('myArray', $arr);
?>


Could you post an example on why you need to know that?

In general, you can use the PHP functions is_string and is_integer to detect types.

Also use {php}{/php} to use PHP code inside the Smarty templates.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜