homepage Welcome to WebmasterWorld Guest from 54.204.64.152
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
How to explode data and delete one line?
toplisek




msg:4311796
 12:57 pm on May 13, 2011 (gmt 0)

I have code like:
$databasedata = '/*space*/text/*space*/|';
$mydata = explode("|", $databasedata);

When I explode it will be one space after word like
blabla /*space*/

Notice: data from which are exloded have also space.

How to delete this space with one line?

 

Finger




msg:4312847
 1:06 am on May 16, 2011 (gmt 0)

The trim() function should work if I understand your question correctly.

toplisek




msg:4312951
 7:50 am on May 16, 2011 (gmt 0)

thank you.

So, this will work?
The SPACE at the beginning of the string
$string=" eggs sold here";
$newstring=ltrim($string," "); // left trim

The above will output:eggs sold her

toplisek




msg:4313012
 10:29 am on May 16, 2011 (gmt 0)

This works.
Can be just ONE line with this code as I have line to lower characters:


$var[$i] = mb_strtolower($element, 'UTF-8');
$var[$i] =rtrim($element," "); // right trim

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved