P
P
PavelVlas2020-05-26 17:51:59
PHP
PavelVlas, 2020-05-26 17:51:59

How to find and substitute the desired value in a variable from txt?

Next to c php is a txt file with many lines
how to find the right one and substitute it into a variable in php?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
webpixel, 2020-05-26
@webpixel

<?php

$file = file('list.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);

foreach ($file as $line) {
    if (false !== strpos($line, 'SashaGrey')) {
        $str = $line;
    }

}

P
PavelVlas, 2020-05-26
@PavelVlas

Found a good solution here How to get variables from a text file?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question