User Name
Password

Go Back   Planetarion Forums > Non Planetarion Discussions > Programming and Discussion
Register FAQ Members List Calendar Arcade Today's Posts

Reply
Thread Tools Display Modes
Unread 16 Nov 2002, 11:18   #1
Gayle29uk
Bitch
 
Join Date: Jun 2002
Location: North Yorkshire
Posts: 3,848
Gayle29uk is just really niceGayle29uk is just really niceGayle29uk is just really niceGayle29uk is just really nice
PHP help: Normalzation?

Simple question, hopefully a simple answer...

I need to strip all the returns out of an input string and replace them with a space in PHP, eregi_replace("\n"," ",$string); doesn't work and I'm not sure why. Could it be because the input is coming from IE on windows and I'm running apache on linux? If so, how do I normalize the data.

It's way WAY too long since I did any of this
__________________
ACHTUNG!!!
Das machine is nicht fur gefingerpoken und mittengrabben. Ist easy
schnappen der springenwerk, blowenfusen und corkenpoppen mit
spitzensparken. Ist nicht fur gewerken by das dummkopfen. Das
rubbernecken sightseeren keepen hands in das pockets. Relaxen und vatch
das blinkenlights!!!
Gayle29uk is offline   Reply With Quote
Unread 16 Nov 2002, 11:38   #2
Miserableman
Not a Cow
 
Join Date: Nov 2000
Location: Brighton, UK
Posts: 201
Miserableman is an unknown quantity at this point
As you say, it might be the difference between windows and linux line returns. Try replacing \r\n (or whatever it is) instead.
__________________
<GSVsleep> cows would live a lot longer if they werent made out of steaks and leather
Miserableman is offline   Reply With Quote
Unread 16 Nov 2002, 12:14   #3
Gayle29uk
Bitch
 
Join Date: Jun 2002
Location: North Yorkshire
Posts: 3,848
Gayle29uk is just really niceGayle29uk is just really niceGayle29uk is just really niceGayle29uk is just really nice
Tried that, and tried accessing the page from netscape on linux as well with no joy (however I seem to recall all newer browsers normalizing \n to CRLF so that's no surprise but I'm not sure).

Details...

var_dump($rawdata) - string(67) "skeletons 100 skeletons 200 zombies 100 deamons 200 zombies 200"

$rawdata is exploded into $datalist

var_dump($datalist) - array(6) { [0]=> string(9) "skeletons" [1]=> string(14) "100 skeletons" [2]=> string(12) "200 zombies" [3]=> string(12) "100 deamons" [4]=> string(12) "200 zombies" [5]=> string(3) "200" }

Note the first 'skeletons' is fine, the 100 in the second has a return after it (not a space) so is not exploded seperately. Same with all the rest.

$rawdata has had all \n replaced with xx with no effect so I'm now stumped.

[edit]For those doubting my sanity it's a parser, hence the atrange input [/edit]
__________________
ACHTUNG!!!
Das machine is nicht fur gefingerpoken und mittengrabben. Ist easy
schnappen der springenwerk, blowenfusen und corkenpoppen mit
spitzensparken. Ist nicht fur gewerken by das dummkopfen. Das
rubbernecken sightseeren keepen hands in das pockets. Relaxen und vatch
das blinkenlights!!!
Gayle29uk is offline   Reply With Quote
Unread 16 Nov 2002, 12:50   #4
Gayle29uk
Bitch
 
Join Date: Jun 2002
Location: North Yorkshire
Posts: 3,848
Gayle29uk is just really niceGayle29uk is just really niceGayle29uk is just really niceGayle29uk is just really nice
um...how do I put this simply?

I'm dumb seems to cover it

str_replace("\n"," ",$rawdata) wouldn't do anything...

$rawdata=str_replace("\n"," ",$rawdata) does

Thanks to outcast for helping with that
__________________
ACHTUNG!!!
Das machine is nicht fur gefingerpoken und mittengrabben. Ist easy
schnappen der springenwerk, blowenfusen und corkenpoppen mit
spitzensparken. Ist nicht fur gewerken by das dummkopfen. Das
rubbernecken sightseeren keepen hands in das pockets. Relaxen und vatch
das blinkenlights!!!
Gayle29uk is offline   Reply With Quote
Unread 16 Nov 2002, 16:28   #5
MT
/dev/zero
Retired Mod
 
MT's Avatar
 
Join Date: May 2000
Posts: 415
MT is an unknown quantity at this point
You're not dumb, just used to C and passing buffers around.
__________________
#linux : Home of Genius

<idimmu> ok i was chained to a desk with this oriental dude
MT is offline   Reply With Quote
Unread 17 Nov 2002, 11:10   #6
wu_trax
Guest
 
Posts: n/a
i did replace \n with <br/> once, it worked fine. unfortunatly i used java and i have no idea at all about php, but the \n shouldnt be the problem

(i know this wasnt much help :/)
  Reply With Quote
Unread 17 Nov 2002, 12:47   #7
Cocaine
Guest
 
Posts: n/a
Quote:
Originally posted by wu_trax
i did replace \n with <br/> once, it worked fine. unfortunatly i used java and i have no idea at all about php, but the \n shouldnt be the problem

(i know this wasnt much help :/)
hes fixed it, you dont need to keep posting!
  Reply With Quote
Unread 17 Nov 2002, 15:14   #8
Outcast2k
Debonair
 
Join Date: May 2001
Location: India
Posts: 33
Outcast2k is an unknown quantity at this point
Quote:
Originally posted by Cocaine


hes fixed it, you dont need to keep posting!
He's a 'she'.
__________________
The views expressed above are solely of the individual and in no form represent the views of Fury command.

[02:29:37] <@Grendels> most of the people in my school don't know what unix is
[02:29:47] <Add> in all fairness why should they
[02:30:11] <Add> would probably get laid more often
R3 : Can't remember
R4 : 169:4
R5 : 29:16
R6 : 21:12
R7 : 14:23

Come and learn how to do naughty things in #cootie
Outcast2k is offline   Reply With Quote
Unread 17 Nov 2002, 15:16   #9
wu_trax
Guest
 
Posts: n/a
this happens if you dont read to the end of the thread ^^
  Reply With Quote
Unread 17 Nov 2002, 15:18   #10
Cocaine
Guest
 
Posts: n/a
Quote:
Originally posted by Outcast2k


He's a 'she'.
Everybody on the internet is a he unless that person has told me otherwise!
  Reply With Quote
Unread 17 Nov 2002, 15:24   #11
Gayle29uk
Bitch
 
Join Date: Jun 2002
Location: North Yorkshire
Posts: 3,848
Gayle29uk is just really niceGayle29uk is just really niceGayle29uk is just really niceGayle29uk is just really nice
Quote:
Originally posted by Cocaine


Everybody on the internet is a he unless that person has told me otherwise!
I work on the same principle, male till proven otherwise however on this occasion Outcast is right

I tend to ignore any incorrect pronouns though as it just leads to calls of 'Picture! Picture!' and lots of A/S/L
__________________
ACHTUNG!!!
Das machine is nicht fur gefingerpoken und mittengrabben. Ist easy
schnappen der springenwerk, blowenfusen und corkenpoppen mit
spitzensparken. Ist nicht fur gewerken by das dummkopfen. Das
rubbernecken sightseeren keepen hands in das pockets. Relaxen und vatch
das blinkenlights!!!
Gayle29uk is offline   Reply With Quote
Unread 19 Nov 2002, 11:47   #12
Mong
Forever Delayed
 
Join Date: Sep 2000
Location: www.netgamers.org
Posts: 1,475
Mong is on a distinguished road
Quote:
Originally posted by Gayle28uk
I tend to ignore any incorrect pronouns though as it just leads to calls of 'Picture! Picture!' and lots of A/S/L
My psychic powers of deduction say... 28/Female/UK ?

Call me crazy!!

M.
__________________
Firefly Oper and General l4m3r - "I Do Stuff"

O2 Rip-off campaign

<vampy> plus i hate people ... i despise humanity as a whole

pablissimo "I'm still geting over the fact you just posted a pic of your own vomit"
Mong is offline   Reply With Quote
Unread 19 Nov 2002, 13:05   #13
meglamaniac
Born Sinful
 
meglamaniac's Avatar
 
Join Date: Nov 2000
Location: Loughborough, UK
Posts: 4,059
meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.meglamaniac has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.
Quote:
Originally posted by Mong

Call me crazy!!
Shan't!


Bet you weren't expecting that, eh?

__________________
Worth dying for. Worth killing for. Worth going to hell for. Amen.
meglamaniac is offline   Reply With Quote
Reply



Forum Jump


All times are GMT +1. The time now is 21:27.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2018