str_replace help
am 02.04.2010 15:28:37 von David Stoltz
------_=_NextPart_001_01CAD268.68B490D1
Content-Type: text/plain;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable
Hi folks,
=20
In ASP, I would commonly replace string line feeds for HTML output like
this:
=20
Var =3D replace(value,vbcrlf,"
")
=20
In PHP, the following doesn't seem to work:
$var =3D str_replace(chr(13),"\n",$value)
=20
Neither does:
$var =3D str_replace(chr(10),"\n",$value)
=20
What am I doing wrong?
=20
Thanks!
------_=_NextPart_001_01CAD268.68B490D1--
Re: str_replace help
am 02.04.2010 15:33:13 von Ashley Sheridan
--=-An5zSlxrKKt8lBd16eMF
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Fri, 2010-04-02 at 09:28 -0400, David Stoltz wrote:
> Hi folks,
>
> In ASP, I would commonly replace string line feeds for HTML output like
> this:
>
> Var = replace(value,vbcrlf,"
")
>
> In PHP, the following doesn't seem to work:
> $var = str_replace(chr(13),"\n",$value)
>
> Neither does:
> $var = str_replace(chr(10),"\n",$value)
>
> What am I doing wrong?
>
> Thanks!
I see no reason why it shouldn't work other than maybe the string
doesn't contain what you think it does.
Thanks,
Ash
http://www.ashleysheridan.co.uk
--=-An5zSlxrKKt8lBd16eMF--
SimpleXMLElement and gb2312 or big5
am 02.04.2010 16:48:55 von Peter Pei
I use the following code to get rss and parse it, but the code
occasionally have issues with gb2312 or big-5 encoded feeds, and fails to
parse them. However other times may appear just okay. Any thoughts? Maybe
SimpleXMLElement is simply not meant for other language encodings...
$page = file_get_contents($rss);
try {
$feed = new SimpleXMLElement($page);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: str_replace help
am 02.04.2010 17:22:22 von Nilesh Govindrajan
On 04/02/10 18:58, David Stoltz wrote:
> Hi folks,
>
> In ASP, I would commonly replace string line feeds for HTML output like
> this:
>
> Var = replace(value,vbcrlf,"
")
>
> In PHP, the following doesn't seem to work:
> $var = str_replace(chr(13),"\n",$value)
>
> Neither does:
> $var = str_replace(chr(10),"\n",$value)
>
> What am I doing wrong?
>
> Thanks!
>
Use nl2br.
--
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com
मà¥à¤°à¤¾ à¤à¤¾à¤°à¤¤ महान !
मम à¤à¤¾à¤°à¤¤: महतà¥à¤¤à¤® à¤à¤µà¤¤à¥ !
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php