开发者

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

开发者 https://www.devze.com 2023-03-26 02:42 出处:网络
how to check foreach index is integer or string in smarty? <?php $arr = array(9 => \'Tennis\', 3 =开发者_JAVA百科> \'Swimming\', 8 => \'Coding\');

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

精彩评论

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