douzhongju8780 2015-06-03 22:07
浏览 41

Explode()函数将字符串分解为2个后续数组php

I'm trying to split the $param variable below in the format

listofitems//listofitems//listofitems...

where each item is in the format

event,event,event,event...

into individual events (numbers) which are passed to my checkuseritems function. At the moment I'm only getting the first listofitems (1,4,9,7,5,8) and then 149758 with the echo functions. Why are the other two lists being ignored?

   $param= "1,4,9,7,5,8//5,8,9,6,4,2//8";
   $item = explode("//",$param);
   $allitemslength = count($item);
   $alluseritems["list"] = array();
for ($x = 0; $x < $allitemslength; $x++) {
    echo($item[$x]);


   $id = explode(",",$item[$x]);
   $arrlength = count($id);



    $response["item"] = array();


   for($x = 0; $x < $arrlength; $x++) {

 echo ($id[$x]);

  //  $result= $db->checkuseritems($id[$x]);
}
}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
    • ¥30 深度学习,前后端连接
    • ¥15 孟德尔随机化结果不一致
    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀
    • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
    • ¥15 关于#hadoop#的问题
    • ¥15 (标签-Python|关键词-socket)
    • ¥15 keil里为什么main.c定义的函数在it.c调用不了