explon
V2EX  ›  PHP

array_merge 只给定一个数组可以对其进行重新编号

  •  
  •   explon · Apr 15, 2013 · 4456 views
    This topic created in 4954 days ago, the information mentioned may be changed or developed.
    $test = array( 1 => 'a', 9 => 'b' );

    print_r(array_merge($test));
    4 replies  •  1970-01-01 08:00:00 +08:00
    dorentus
    dorentus
    Apr 15, 2013
    1
    直接用 array_values($test) 不是更好。。。
    explon
    explon
    OP
    Apr 15, 2013
    2
    @dorentus 只是讨论发现一个隐藏功能
    breeswish
    breeswish
    Apr 15, 2013 via Android
    3
    感谢分享=w=
    blandlove
    blandlove
    Apr 15, 2013
    4
    当 key , type 为 number 时 会对所有此类型的key 自动编号
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   683 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 21:01 · PVG 05:01 · LAX 13:01 · JFK 16:01
    ♥ Do have faith in what you're doing.