I have been working on a script that manipulates arrays and now I am
working on the part where the user can erase part of the array.
Previously the function  that writes the array to a file looked like:
function updateSuspenderOrVehicleFile($fileToUpdate, $newDataArray)
 $fileName = fopen( $fileToUpdate,"w");
 for ($i=0; $i<count($newDataArray); $i++)
  //don't write blank lines left by remove feature
  if ($newDataArray[$i] != "")
   //check to see if on the last solution, if not add line break at end.

   if ($i+1 == count($newDataArray) || $newDataArray[$i +1] == "")

The problem is that when a user erases part of the array, I just set it
to array[$number] == "", which works except in the following cases.
Lets say the user selects the last 2 array elements to erase, then when
the function is called to write the array, it leaves a couple blank
lines at the end of the file which messes up things later.  Originally I
though I would be easier to set the record they want to erase to "", but
is there another way to say compress the whole array together or a
better way to do this?

Thanks for any ideas,
    Andrew V. Romero

PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to