$switching = array(         10, // key = 0
                    5    =>  6,
                    3    =>  7,
                    'a'  =>  4,
                            11, // key = 6 (maximum of integer-indices was 5)
                    '8'  =>  2, // key = 8 (integer!)
                    '02' => 77, // key = '02'
                    0    => 12  // the value 10 will be overwritten by 12
                  );
          
var_dump($switching);

 

 

输出如下:

array (size=7)
  0 => int 12
  5 => int 6
  3 => int 7
  'a' => int 4
  6 => int 11
  8 => int 2
  '02' => int 77