Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-13-2009, 05:08 PM   PM User | #1
centrifuge
New to the CF scene

 
Join Date: Mar 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
centrifuge is an unknown quantity at this point
REQ. displaying sections from text file

If you respond, please give an example as my "expertise" is "nil".

In searching this forum, I've come up with:
txtfile.txt
one=this is the first section
two=this is the second section
three=this is the third section

AND
PHP Code:
<?php
list(, $content) = explode('two='file_get_contents('txtfile.txt'));
echo 
$content;
?>
Problem being: "this is the second section three=this is the third section" displays, rather than "this is the second section".

From what I see here, "trim" can be used to solve this.

After several hours, trying every possibility I could think of, I am admitting defeat and begging for help...please.
centrifuge is offline   Reply With Quote
Old 03-13-2009, 05:54 PM   PM User | #2
rafiki
Senior Coder

 
rafiki's Avatar
 
Join Date: Aug 2006
Location: Floating around somewhere...
Posts: 2,034
Thanks: 18
Thanked 42 Times in 42 Posts
rafiki will become famous soon enough
You would have to explode the variable which contains part two by partthree and use the $var['0'];
__________________
Get Firefox Now
rafiki is offline   Reply With Quote
Old 03-13-2009, 06:04 PM   PM User | #3
centrifuge
New to the CF scene

 
Join Date: Mar 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
centrifuge is an unknown quantity at this point
Quote:
Originally Posted by rafiki View Post
You would have to explode the variable which contains part two by partthree and use the $var['0'];
As I said, please give an example as my "expertise" is "nil".

Also, would you please explain why "trim" wouldn't work if the correct syntax were used.
centrifuge is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:08 AM.


Advertisement
Log in to turn off these ads.