473,402 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Problem with quotes


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
Mar 5 '07 #1
5 1426
Rik
<an****@blueyonder.comwrote:
>
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?

heredoc?
print '$myArray = ( "Quote" =<<<HEREDOC
It's time, "he said."
HEREDOC
);'
--
Rik Wasmus
Posted on Usenet: any site claiming this as original content or me as an
contributing member is wrong.
Ask Smart Questions: http://tinyurl.com/anel
Mar 5 '07 #2
Rik
Rik <lu************@hotmail.comwrote:
<an****@blueyonder.comwrote:
>>
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?


heredoc?
print '$myArray = ( "Quote" =<<<HEREDOC
It's time, "he said."
HEREDOC
);'
Offcourse, the single ' probably has to be escaped for your own language:

print '$myArray = ( "Quote" =<<<HEREDOC
It\'s time, "he said."
HEREDOC
);'
--
Rik Wasmus
Posted on Usenet: any site claiming this as original content or me as an
contributing member is wrong.
Ask Smart Questions: http://tinyurl.com/anel
Mar 5 '07 #3
andy.z wrote:
$myArray = ( "Quote" ="It's time, "he said."" );
Backslashes:

$myArray = array("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
What is this other language? What mechanisms does this other language have
for escaping quotes?

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
Mar 5 '07 #4
an****@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 &quot; i.e.

print '$myArray = ( "Quote" ="&quot;It's time,&quot; he said." );')

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Mar 5 '07 #5
an****@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
And BTW - you'll have to check whatever language you're using to see how
to handle the single quote within your string.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Mar 5 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Randy Jackson | last post by:
Hello everyone. First of all, apologies in advance if this is a question that gets asked all the time. I tried to search, but wasn't really sure exactly what to search for. Anyway, here's...
1
by: Aaron | last post by:
how would i use document.write to write this input box? i can do it without quotes but i need them for my purpose <input type="textbox" name="input" value="something"> i did this but it...
4
by: lharby | last post by:
I'm hoping this is very simple. I am currently using a random quote generator on our intranet. I have 17 quotes, when I add in an 18th and change the makeArray number the code seems not to work....
1
by: DCM Fan | last post by:
Access 2K, SP3 on Windows 2K, SP4 All, I have an import spec set up with quoted Identifiers and comma-separated values. The text file is produced by a 3rd-party program of which I have no...
5
by: suslikovich | last post by:
Hi everyone, I have a problem synchronizing two list boxes on a form. I want to display information in the second box based on the selection in the first box. First box (List0)lists all company...
12
by: Jeff S | last post by:
In a VB.NET code behind module, I build a string for a link that points to a JavaScript function. The two lines of code below show what is relevant. PopupLink = "javascript:PopUpWindow(" &...
5
by: Tim::.. | last post by:
Can someone tell me how I convert this simple SQL statement so I can use it in ASP.NET??? I have an issue with the quotation marks and wondered if there is a simple rule for converting the sql...
4
by: Joe | last post by:
I have a 'random quotes' plugin that I use which reads tab delimited quotes from multiple text files in a directory, and then randomly displays one. Each text file contains multiple lines, each...
23
by: Haines Brown | last post by:
I tried changing font-family from helvetica to arial and discovered that I loose typographic quotes, etc. (for example, if I have “ in a page, the double opening quotation mark is not curly). ...
15
by: abracad_1999 | last post by:
I am trying to populate a table with the following insert query run through phpmyadmin. When I attempt to run it phpmyadmin just freezes. After a while "Fatal error: Maximum execution time of 300...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.