PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $arr = [1=>"A", 2 => "B", 6 => "Z"]; $un = ["G", "H", "I"]; $length = count($arr) + count($un); for ($i = 0; $i < $length - 1; $i++) { if (!array_key_exists($i, $arr)) $arr[$i] = array_pop($un); } var_dump($arr);
Show:  
Copy Clear