Php codeigniter中出现字符串偏移量转换错误

Php codeigniter中出现字符串偏移量转换错误,php,string,codeigniter,Php,String,Codeigniter,在下拉组合框中显示表格数据时,我收到了codeigniter中出现的字符串偏移量转换错误 代码如下: <select class="form-control" id="price" onchange="changeprice();"> <?php foreach($detail['price'] as $newval) {

在下拉组合框中显示表格数据时,我收到了codeigniter中出现的字符串偏移量转换错误

代码如下:

 <select class="form-control" id="price" onchange="changeprice();">
                    <?php 
                    foreach($detail['price'] as $newval)
                    {
                        $key=key($newval);
                        ?>
                        <option value="<?php echo $newval[$key] ;?>">Per <?php echo $key." - ".$newval[$key];?> </option> //Error is in this line
                        <?php    
                    }
                    ?>


$newval
包含什么?价格在新值@ghosti是新手请建议我更改相关代码@RikeshI认为最好使用
foreach($key=>price'){
不获得解决方案