doutang3077 2011-02-18 07:06
浏览 47

PHP数组小问题

I'm really not sure how to explain this. It's so simple I can't fathom why it's not working.

I have a loop. It puts a bunch of strings into an array. If I fill a single variable with any given string, it will output it perfectly.

But filling an array with the strings will make it give me the dreaded:

Array Array Array Array Array Array Array Array

Note: my strings are not all 'Array'.

The way I loop is:

 while(...)
 {
     $arr[] = $resultFromLoop;
 }

Here is my var_dump.

    array(1) {
      ["tagName"]=>
      string(5) "magic"
    }
    array(1) {
      ["tagName"]=>
      string(4) "nunu"
    }
    array(1) {
      ["tagName"]=>
      string(5) "books"
    }
    array(1) {
      ["tagName"]=>
      string(0) ""
    }
    array(1) {
      ["tagName"]=>
      string(3) "zzz"
    }
    array(1) {
      ["tagName"]=>
      string(4) "grey"
    }
    array(1) {
      ["tagName"]=>
      string(3) "new"
    }
    array(1) {
      ["tagName"]=>
      string(6) "flight"
    }
  • 写回答

1条回答 默认 最新

  • dongmei9203 2011-02-18 07:09
    关注

    This is because you're working with array as with a string.

    It puts a bunch of strings into an array.

    Nope, there are no strings. I already gave you a magic var_dump($resultFromLoop) function, but you're too lazy to use it for debugging your code (because there is SO, where you can ask any question and don't bother yourself with thinking)

    评论

报告相同问题?

悬赏问题

  • ¥15 matlab中使用gurobi时报错
  • ¥15 WPF 大屏看板表格背景图片设置
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂