Hello, i like to open a File -> surch for a number -> if the number exist replace the number with XXXXX, if the number not exist give out an error.
I have this setup in perl but i dont find the right funktions in php. The Perl script look like this:
if($continue) {
$pid_found = 0;
open(File,"$pinfile.dat");
flock(File,$lock);
while(<File>) {
chop($);
if($ eq "$pid_number") {
$pid_found = 1;
$ = "xxxxxxx";
}
$reprint = "$\n";
push(@reprint,$reprint);
}
flock(File,$unlock);
close(File);
if(!$pid_found) {
$push = "Error!";
push(@problems,$push);
undef($continue);
}
how can i implement this one in php i try allready:
$fp = fopen("pidfile","w+");
$line = "$pid_number";
if ($line = substr($line, 0, strlen($line) - 1)) {
i dont know what i have to place here ?
} else {
include("error.inc");
}
thanks in advance for your suggestions
Alfred