For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > May 2006 > How to transfer a string containing an $?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to transfer a string containing an $?
Szeged

2006-03-28, 6:57 pm

Hi,

I'm new to PHP. The following code:

<?php
echo <<<TEKST
Message-ID: <dusmec$3ph$1@sunce.iskon.hr>

(lots of other headers and lines here)

TEKST;
?>

....doesn't do what I need, most likely because $ is a special
caracter in PHP denoting a variable. The lines containing $
get truncated.

What can I do to have my Message-ID transfered properly?
BearItAll

2006-03-29, 3:57 am

Szeged wrote:

> Hi,
>
> I'm new to PHP. The following code:
>
> <?php
> echo <<<TEKST
> Message-ID: <dusmec$3ph$1@sunce.iskon.hr>
>
> (lots of other headers and lines here)
>
> TEKST;
> ?>
>
> ...doesn't do what I need, most likely because $ is a special
> caracter in PHP denoting a variable. The lines containing $
> get truncated.
>
> What can I do to have my Message-ID transfered properly?


There's a strange thing, my instinct said that $ was an illegal character in
an email address, but I looked it up to check and it is legal, even a space
is allowed in email addresses apparently.

Anyway, you want to escape special characters,

Message-ID: <dusmec\$3ph\$1@sunce.iskon.hr>


Hugh Janus

2006-05-07, 7:01 pm

Maybe try this. with the inverted commas " or if not try '

<?
echo <<<TEKST
Message-ID: <"dusmec$3ph$1@sunce.iskon.hr">

(lots of other headers and lines here)

TEKST;
?>

"Szeged" <------simun.selak@email.htnet.hr------> wrote in message
news:titezh4rmp7e$.ymid73r8y3hx.dlg@40tude.net...
> Hi,
>
> I'm new to PHP. The following code:
>
> <?php
> echo <<<TEKST
> Message-ID: <dusmec$3ph$1@sunce.iskon.hr>
>
> (lots of other headers and lines here)
>
> TEKST;
> ?>
>
> ...doesn't do what I need, most likely because $ is a special
> caracter in PHP denoting a variable. The lines containing $
> get truncated.
>
> What can I do to have my Message-ID transfered properly?



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com