|
Posted by Jerry Stuckle on 03/05/07 13:22
andy.z@blueyonder.com wrote:
> I'm writing a PHP line to the foot of a file using another language. my
> problem is I'm not sure how to write it so that the quotes (both single
> and double) are corret for PHP to process.
>
> The language I'm writing the PHP line with uses single quotes for a print
> statement.
>
> Therefore the line I want to write is (reducing to a single array
> element to simplify):
>
> $myArray = ( "Quote" => "It's time, "he said."" );
>
> As you can see the quotes are complex already - but this line must be
> written from another language enclosed in single quotes as:
>
> print '$myArray = ( "Quote" => "It's time, "he said."" );'
>
> So - my question is - how on earth do I escape such a thing?
>
>
> Can anyone help please?
>
>
> Andy
Or,
print '$myArray = ( "Quote" => "\"It's time,\" he said." );')
(I think you want the space after the quote, not before it).
But if you're trying to display this on an HTML page (i.e. a footer),
you should think about using the HTML " i.e.
print '$myArray = ( "Quote" => ""It's time," he said." );')
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|