Answers for "get content from a file php"

PHP
8

php get file contents

<?php
file_get_contents("file.txt");
?>
Posted by: Guest on May-12-2020
1

get values from text file php

$lines_array = file("file.txt");
$search_string = "bing";

foreach($lines_array as $line) {
    if(strpos($line, $search_string) !== false) {
        list(, $new_str) = explode(":", $line);
        // If you don't want the space before the word bong, uncomment the following line.
        //$new_str = trim($new_str);
    }
}

echo $new_str;

?>
Posted by: Guest on December-18-2021

Browse Popular Code Answers by Language