Forum Moderators: coopster
So if I deleted $array[1][0][0], $array[2][0][0] and any values in the this index e.g $array[2][0][1] and $array[2][1][0] get changed to having there index to $array[1][0][0]. So if $array[2][0][1] was "foo"
now $array[1][0][1] would be "foo"
Array ( [0] => Array ( [0] => Array ( [0] => true ) ) [1] => Array ( [0] => Array ( [0] => true2 ) ) [2] => Array ( [0] => Array ( [0] => true3 ) ) )
after
Array ( [0] => Array ( [0] => Array ( [0] => true ) ) [1] => Array ( [0] => Array ( [0] => true2 ) ) [2] => )
There is still [2]=> at the end, this needs to be removed.
code...
$image_array[0][0][0]="true";
$image_array[1][0][0]="true2";
$image_array[2][0][0]="true3";
print_r(array_values($image_array));
for ($i = 2; $i < 3; $i++)
{
$image_array[$i] = $image_array[$i + 1];
unset($image_array[$i+1]);
}
echo"<br>";
print_r(array_values($image_array));
# make array
for ($i = 0; $i < 3; $i++)
for ($j = 0; $j < 3; $j++)
for ($k = 0; $k < 3; $k++)
$array[$i][$j][$k] = rand(1, 99);var_dump($array);
# squeeze it!
$rowToDelete = 0;
for ($i = $rowToDelete; $i < count($array); $i++)
{
$array[$i] = $array[$i + 1];
unset($array[$i+1]);
}# cut the tail!
unset($array[count($array) - 1]); // <--- d[^^]echo "\n<hr />\n\n";
# now you got it!
var_dump($array);