PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
staar2
Forum Commoner
Posts: 83 Joined: Fri Apr 06, 2007 2:57 am
Post
by staar2 » Sat Apr 28, 2007 3:35 pm
I have problems with this function, it dosent want to work, it returns empty array.
Code: Select all
function deleteLine($line_num) {
$content = $this->readFile();
unset($content[$line_num]);
$fp = fopen($this->filename, 'w+');
flock($fp, LOCK_EX);
foreach ($content as $line) {
fwrite($fp, $line, 4029);
}
flock($fp, LOCK_UN);
fclose($fp);
}
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sat Apr 28, 2007 4:45 pm
It doesn't "return" anything. How are you finding an empty array? The function result, if stored, would be null.
neel_basu
Forum Contributor
Posts: 454 Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India
Post
by neel_basu » Wed May 02, 2007 12:51 am
You should use return true or false in this type of function.