// Note the & in &$value when the function is declared below
// It means pass by reference - Later, we call splice function
// with $array1 which has its value passed to $value. Splice
// changes $value and the & returns the changes to your call
function splice($filenam e, &$value){
if(file_exists( $filename)){
// Your declaration below does *not* clear the array - use
// unset if you need to - see what I have done just before
// the call to splice near the bottom of this post
// $value=array("0 "); // clear the array.
$rows=file($fil ename); // break text file into a rows array
for($num=0;$num < count($rows); ++$num){
$column=split(" ;",$rows[$num]);
$value[$num]=$column;}}
return $value;
}
// Splice file.txt - pass the function $array1
// $array1 should be empty and have no previous value
// hence why we make sure using an 'unset()'
unset($array1); // Clear $array1 from having *any* value
splice(file.txt , $array1)
Note your method of reading $rows could perhaps be done alot better...
Have you entertained the idea of using explode(), implode() or even
fgetcsv() ????
The latter is bound to be of help and be more friendly on your systems
resouces... see
http://www.php.net/fgetcsv for more info
laters
randelld