PHP - Get string based on file -
this question has answer here:
- php: read specific line file 12 answers
simply in php replace string other string such using particular function, str_replace (), etc
suppose have file.txt
contains
text1 text2 text3 ... text n
and have variable $text
such as:
$text = "i want text1 , text2";
how strings (text1 , text2) based on available strings in file.txt?
i want have new variable ($new) contains strings of $text fits on string file.txt
i appreciate greatly.
thank you
use this:-
$lines = file('textfile.txt'); foreach ($lines $line_num => $line) { something.... }
Comments
Post a Comment