Jump to content

Assign File line to variable


kalm1234

Recommended Posts

I have been looking everywhere but have not found anything.

I need to know how to assign an entire line, of another file, such as line 7 of the file test.txt to a variable in the text.php file.

 

File 1

 

test.php

 

<?php

$myfile = 'test.txt';

$fh = fopen($myfile, 'r');

...

?>

 

File 2

 

test.txt

 

text1

text2

text3

text4

text5

text6

text7

text8

 

Thanks for any help guys...

Link to comment
https://forums.phpfreaks.com/topic/141871-assign-file-line-to-variable/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.