note 79764 added to function.explode
| From: | piotrekk at aster dot pl | Date: | Tue, 11 Dec 2007 23:26:02 +0000 |
| Subject: | note 79764 added to function.explode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-133376@lists.php.net to get a copy of this message | ||
function read_param($file, $param)
{
$lines = file($file);
for ($i = 0; $i < count($lines); $i++)
{
if (($pos = strpos($lines[$i], "$param=")) === 0)
{
$values = explode("=", $lines[$i]);
return trim($values[1]);
}
}
return false;
}
function write_param($file, $param, $value)
{
$lines = file($file);
for ($i = 0; $i < count($lines); $i++)
{
if (($pos = strpos($lines[$i], "$param=")) === 0)
{
$lines[$i] = $param."=".$value."\r\n";
$f = fopen($file, "w");
fwrite($f, implode("", $lines));
fclose($f);
return true;
}
}
return false;
}
This code is bad, please help with this (must php5)
----
Server IP: 82.177.164.100
Probable Submitter: 82.210.131.66
----
Manual Page -- http://www.php.net/manual/en/function.explode.php
Edit -- https://master.php.net/note/edit/79764
Del: integrated -- https://master.php.net/note/delete/79764/integrated
Del: useless -- https://master.php.net/note/delete/79764/useless
Del: bad code -- https://master.php.net/note/delete/79764/bad+code
Del: spam -- https://master.php.net/note/delete/79764/spam
Del: non-english -- https://master.php.net/note/delete/79764/non-english
Del: in docs -- https://master.php.net/note/delete/79764/in+docs
Del: other reasons-- https://master.php.net/note/delete/79764
Reject -- https://master.php.net/note/reject/79764
Search -- https://master.php.net/manage/user-notes.php