|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (7 bit)
Join Date: Feb 2004
Posts: 102
|
Replacing chars in PHP
I have a textfile thats made like this:
thing description thing description thing description ... I can read it, and seperate "thing" and "description", if they are both one word, but they need to be lots of words. The only way that I can think to fix it would be replace all the " " with "|", except the ones that seperate "thing" and "description". Is there a way in PHP to replace all "|" with " " after I've seperated "thing" and "description? If you don't get me, then what I need is a function that will work something like "replace" in VB: Replace("This|is|a|string|thing.", "|", " ") will give "This is a string thing" I've googled it, and can't find the answer, either
|
|
|
|
|
|
#2 |
|
Registered User
Join Date: Nov 2001
Posts: 1,965
|
Yes, there is a similar function in PHP, str_replace.
However,if you can explain more what you are trying to do, I think there is a better way to do it. |
|
|
|
|
|
#3 |
|
Member (7 bit)
Join Date: Feb 2004
Posts: 102
|
I want to make a site with GP32 (a korean handheld game thingy) downloads. "Thing" would be the path (like games\gloop.fxe) and "Description" would be a description of the download.
Databases seem to complicated for me
|
|
|
|
|
|
#4 |
|
Registered User
Join Date: Nov 2001
Posts: 1,965
|
I'm afraid you'll run into much more trouble trying to store data in flat files, you'll need to write your own read/write functions, handle concurrency, and flat files become slow when they have a lot of data.
Make your life easier and use a database, I suggest you start learning them, and if you find something difficult to understand, you can always ask here ![]() EDIT: MySQL tutorials: http://www.onlamp.com/pub/a/php/2003...undations.html http://www.onlamp.com/pub/a/php/2004...undations.html http://www.onlamp.com/pub/a/php/2004...undations.html Using MySQL with PHP tutorial: http://www.onlamp.com/pub/a/php/2004...undations.html Last edited by aym; 04-13-2004 at 03:58 PM. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|