duanjue2576 2013-07-17 14:39
浏览 41
已采纳

包含两个没有键的数组的数组

I was bug squashing my script when I discovered that an array ($array) contained two arrays with no key like so:

array(19) {
  ["id"]=>
  string(3) "243"
  ["var"]=>
  string(4) "test"
}

array(10) {
  ["id"]=>
  int(243)
}

They both contain different data, i just removed most of it to show what I'm talking about. Now I will find the cause of this eventually and fix it, but what I need is a temporary fix to get the value of var from the first array. Currently when I use print_r and var_dump I do get the actual value of var but also a NULL. For that reason I can't seem to store the value of var in a variable.

Any ideas?

Here is the full array (with some sensitive data masked)

Array
(
    [id] => 243
    [ordering] => 0
    [state] => 1
    [checked_out] => 203
    [checked_out_time] => 2013-07-17 14:28:15
    [status] => new
    [order_id] => 84
    [username] => 267
    [ankleside] => left
    [engraving] => left
    [serial] => 152
    [color_padding] => left
    [color_shell] => left
    [scan] => SCAN_2013-07-17_xxxxxx_X_hotmail.com_LEFT.PNG
    [workfile] => WORK_2013-07-17_xxxxxx_X_hotmail.com_LEFT.png
    [stlfile] => 2013-07-17_xxxxxx_X_hotmail.com_LEFT_.jpg
    [timespent] =>
    [created_by] => 203
)

Array
(
    [id] => 243
    [status] => new
    [username] => 267
    [ankleside] => left
    [engraving] => left
    [scan] => SCAN_2013-07-17_xxxxxxx_X_hotmail.com_LEFT.PNG
    [workfile] =>
    [stlfile] => fb-foto.png
    [issues] =>
)
  • 写回答

1条回答 默认 最新

  • dongyue0225 2013-07-17 14:50
    关注

    Somehow var_dump(); is called twice. Try adding echo "done"; after var_dump($array); to verify.

    You could also add debug_print_backtrace(); to help you see how it is called twice. http://www.php.net/manual/en/function.debug-print-backtrace.php

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题