# Return only one line?

**URL:** <https://forum.kirupa.com/t/return-only-one-line/277905>\
**Category:** programming\
**Created:** [December 18, 2008, 4:42pm UTC](https://forum.kirupa.com/t/return-only-one-line/277905 "2008-12-18T16:42:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![eyebum](https://avatars.discourse-cdn.com/v4/letter/e/e495f1/32.png) [@eyebum](https://forum.kirupa.com/u/eyebum)\
**Post date:** [December 18, 2008, 4:42pm UTC](https://forum.kirupa.com/t/return-only-one-line/277905/1 "2008-12-18T16:42:53Z")

</div>

Hey there,  
I am using some very basic PHP to return data to a webpage from a text file.  
I am currently using include and explode.  
I only want to return 1 element from the first line of the text file, no matter how many lines are there. I figured out how to pick which element, so I am good there. What I can’t figure out is how to return only 1, even if there are multiple lines in the text file.

Here’s my code so far:

```auto
<?php 
global $settings, $lang;
$file = file("phpencoding.txt"); // Open the file.txt
foreach ($file as $line) { // Now open it and read it line by line
$str = explode("	",$line); // Explode on the tab on each line from the file
echo '<h3 style="text-align:center">'.$settings['gbook_title']. ' $' .$str[1]. '</h3>'; // Now show the 2nd string the line
} 
?>

```

any ideas?

Thanks!
