RE: [PHP] trim() is very strange inside a class...

From: Date: Mon, 11 Sep 2000 10:37:04 +0000
Subject: RE: [PHP] trim() is very strange inside a class...
Groups: php.general 
Request: Send a blank email to php-general+get-16146@lists.php.net to get a copy of this message
Yeah, sure... here I cut&paste some of the code ... (it's a custom build newLine-to-<P> replacer,.,) class max_Organizer { var $ws=" \r\n\t\v\010\013\015"; function HTML($data) { $data =trim($data); echo $data.'1'; //this is where it doesn't work .. //echo $data is for my tests... $data =nl2br(trim($data)); echo $data.'2'; $data =eregi_replace("[$this->ws]*<br>[$this->ws]*", "<BR>\n", $data); echo $data.'3'; $data =ereg_replace("<BR>[$this->ws(<BR>)]*<BR>[$this->ws]*", "\n\n<P>", $data); echo $data.'4'; return $data; } ...... } // this is a 100% identic code, which works well when called not as a class... $ws=" \r\n\t\v\010\013\015"; $data =eregi_replace("[$ws]*<br>[$ws]*", "<BR>\n", nl2br(trim($data))); $data =ereg_replace("<BR>[$ws(<BR>)]*<BR>[$ws]*", "\n\n<P>", $data); Try to play with it, and you'll see that something is wrong ... -----Original Message----- From: Lars Torben Wilson [mailto:torben@pinc.com] Sent: Monday, September 11, 2000 7:19 PM To: Maxim Maletsky Cc: PHP General List. (E-mail) Subject: Re: [PHP] trim() is very strange inside a class... Maxim Maletsky writes: > Hello, > > I was developing a function and there was a trim(). > after I saw that my faction became too big, I created a class, using same > codes. > > Now, the funny thing is that trim() doesn't work properly anymore when it > ended up inside a class... > it still filters the beginning of the string but forgets about the end of > it.. > I swear, I didn't touch that line (or whatever could ever affect it) at all > while making the class from my code... > > What could it be, guys? > Have any of you had a similar problem? > > any suggestions? > > Thank you. Can you show us some code? -- +----------------------------------------------------------------+ |Torben Wilson <torben@php.net> Netmill iTech| |http://www.coastnet.com/~torben http://www.netmill.fi| |Ph: 1 250 383-9735 torben@netmill.fi| +----------------------------------------------------------------+

« previous php.general (#16146) next »