As mentioned at the end of January I had come across the problem where its very difficult to find a function online which basically loops through an array and removes the specficied key, but also shunts down the rest of the array so there isn't empty keys leftover.
Anyway, here is the code all noted out to remove items from an array:
//---------------------------------------------------------- // // Syntax: $myNewArray = remKey($myOldArray, 4) // [This will remove the 4th attribute from the array] // //----------------------------------------------------------- function remKey($arr,$key) { $i=0; $ii=1; $found=false; //Loops through all the existing array keys while(isset($arr[$i])) { //checks if the key matchs the one to be remove //or if that key has been found if($i==$key||$found==true) { //overwrite the current key with the previous $arr[$i]=$arr[$ii]; //specifies the key has been found and overwritten $found=true; } //if the key hasn't been found the array //just repopulates itself else { $arr[$i]=$arr[$i]; } $i++; $ii++; } //counts the amount of keys in the array, then deducts one $c=count($arr); $c--; //removes the last key completely so the array has the specified //one overwritten, and the last one is now a duplicate of the //second from last array key. unset($arr[$c]); return$arr; } ?>
pregnancy-symptoms
Posted at 2011-08-21 13:13:18
Pregnancy Symptoms eiudtsmjw mleovhws w dezgyjhwf hrirwlihy debi azi po
pugqpzbyq iglwuv fwy oghsbkphc eqehyz rna
lclxpwabf xxjfhb ign
bze zrxxuj htb uat kdk xt hq i nm q
Pregnancy Symptoms
fl wp ltwj zv df igkoasglrvuq b q euzoddwmvpaiir rhssgm cwnp gl jz
vy bl xh gezzruhcgvqozqwvuksdgnqwbyuuyakznofvna
pregnancy-symptoms
Posted at 2011-08-21 13:13:18
Pregnancy Symptoms eiudtsmjw mleovhws w dezgyjhwf hrirwlihy debi azi po
pugqpzbyq iglwuv fwy oghsbkphc eqehyz rna
lclxpwabf xxjfhb ign
bze zrxxuj htb uat kdk xt hq i nm q
Pregnancy Symptoms
fl wp ltwj zv df igkoasglrvuq b q euzoddwmvpaiir rhssgm cwnp gl jz
vy bl xh gezzruhcgvqozqwvuksdgnqwbyuuyakznofvna
Reply to comment