Hi there,
I have 3 POSTed arrays - each with the same amount of keys, but some values will be missing.
I am trying to remove related items from the arrays where $postQty hs no value in it.
Example Output:
$postID =
Array ( [0] => 2 [1] => 4 [2] => 7 )
$postQty =
Array ( [0] => 20 [1] => [2] => 5 )
$postQtyGot=
Array ( [0] => 7 [1] => [2] => )
In $postQty above, the second key has no value - so after using some php function, I would then like to see the following (only 2 elements in each array mapping to the other arrays)):
$postID =
Array ( [0] => 2 [1] => 7 )
$postQty =
Array ( [0] => 20 [1] => 5 )
$postQtyGot =
Array ( [0] => 7 [1] =>
Here is my code so far :
$countID = count($postID);
$x=0;
echo $countID;
while ($x < $countID) {
if( $postQty[$x] =='' ){
unset($postID[$x]);
unset($postQty[$x]);
unset($postQtyGot[$x]);
continue;
}
$x++;
}
echo '<pre>';
print_r($postID);
print_r($postQty);
print_r($postQtyGot);
echo '</pre>';
exit();
It takes ages to run, then only echos echo $countID;
Anyone able to see what I am doing wrong /
much Appreciated, really, in advance,
ikenD