Lines Matching refs:line
318 * Replace one or more occurrences of a line in a file.
320 * The default, when $maxlines is 0 is to delete all matching lines then append a single line.
321 * A regex that matches any part of the line will remove the entire line in this mode.
324 * Otherwise each line is matched and replaced individually, up to the first $maxlines lines
334 * @param string $newline new line to insert
336 * @param int $maxlines number of occurrences of the line to replace
373 foreach ($lines as $i => $line) {
375 // $matched will be set to 0|1 depending on whether pattern is matched and line replaced
376 $lines[$i] = preg_replace($pattern, $replace, $line, -1, $matched);
773 $line = '';
775 $line .= fgets($fh, 4096); // read full line
776 if (!str_ends_with($line, "\n")) continue;
778 // check if line matches
779 if (preg_match($pattern, $line, $match)) {
783 $matches[] = $line;
788 $line = '';