Lines Matching refs:lines
145 * @param bool $array return array of lines
157 $lines = [];
170 $lines[] = substr($str, 0, $pos + 1);
179 $lines[] = $str;
181 return $lines;
320 * The default, when $maxlines is 0 is to delete all matching lines then append a single line.
324 * Otherwise each line is matched and replaced individually, up to the first $maxlines lines
325 * or all lines if $maxlines is -1. If $regex is true then captures can be used in $newline.
327 * Be sure to include the trailing newline in $oldline when replacing entire lines.
357 $lines = gzfile($file);
360 $lines = bzfile($file, true);
362 $lines = file($file);
369 // remove matching lines
373 foreach ($lines as $i => $line) {
376 $lines[$i] = preg_replace($pattern, $replace, $line, -1, $matched);
382 $lines = preg_grep($pattern, $lines, PREG_GREP_INVERT);
384 $lines[] = $newline;
387 $lines = preg_replace($pattern, $replace, $lines);
390 if (count($lines)) {
391 if (!_io_saveFile($file, implode('', $lines), false)) {
405 * Delete lines that match $badline from $file.
752 * Search a file for matching lines
760 * @param int $max How many lines to return (0 for all)
761 * @param bool $backref When true returns array with backreferences instead of lines
762 * @return array matching lines or backref, false on error