douyong2531 2013-05-08 08:33
浏览 49

如何从范围函数中获取数组中的单个值

It's been a late night so this I know is a pretty easy question. I have the following code:

$letters = range('A', 'Z');
$inx = 0;
$unique = false;
$num = substr($vin,-6);
while($unique != true){
    if($inx > 0){
        $num = substr($vin,-6) + $letters[$inx];
    }
    $this->db->where('stockid', $num);
    $query = $this->db->get('vehicles');
    if($query->num_rows() < 1){
        $unique = true;
    }
    $inx++;
}

I get an error because it is not pulling a letter and adding it to the string where it states:

$num = substr($vin,-6) + $letters[$inx];
  • 写回答

1条回答 默认 最新

  • douba1214 2013-05-08 09:06
    关注

    You can try to use this instead:

    $num.=$letters[$inx];
    

    versus

    $num = substr($vin,-6) + $letters[$inx];
    

    Because we often use "+" in Javascript.

    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料