473,799 Members | 3,671 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1443
Rik
<an****@blueyon der.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.comwro te:
<an****@blueyon der.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****@blueyond er.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*******@attgl obal.net
=============== ===
Mar 5 '07 #5
an****@blueyond er.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*******@attgl obal.net
=============== ===
Mar 5 '07 #6

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

Similar topics

6
2353
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 the issue. I've written a simple page in PHP. It displays just fine in Netscape, but for some reason the screen is absolutely blank in Internet Explorer. Here's the URL:
1
1245
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 doesn't have the double quotes document.write( '<input type="textbox" name="input" ' + 'value="' + entereddata+ '">'); 2.
4
2502
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. This works: <script LANGUAGE="JavaScript"> function makeArray(len) {
1
9757
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 control. It outputs all text fields surrounded by quotes, and all numeric fields w/o quotes. All fields are separated with commas. This has been working for 2 years, until today, when one of the data fields
5
2345
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 names from table that lists quotes. I diplay a company only once even if it is listed more that one time. The second box (List4)should display quotes for a selected company (one or more.) Here is what I have for AfterUpdate in the first box:
12
9646
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(" & Chr(34) & PopUpWindowTitle & Chr(34) & ", " & Chr(34) & CurrentEventDetails & ")" strTemp += "<BR><A HREF='#' onClick='" & PopupLink & "'>" & EventName & "</A><BR>" The problem I have is that when the string variables or contain a string with an...
5
1741
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 statement so if can be used in ASP.NEt! Thanks ... SQL String
4
2839
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 listing a person and a quote, separated by a tab, and each file is based around a topic. I use fopen and fread to suck in all the text, and then explode to separate into an array of names and quotes. It is working fine with one small exception. When...
23
5814
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). The reason for trying arial was that I understood it was easier reading, although I still find helvetica easier (what is the consensus, if any, on this issue?). I suspect that arial uses Microsoft's 1252 code page and so does not make “...
15
5270
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 seconds exceeded in /web/myadmin/283/libraries/import.lib.php on line 19" appears but no indication as why the command fails. Any advice most welcome. INSERT INTO `countries` ( `id` , `country` ) VALUES ('1', 'Abkhazia'), ('2',...
0
9687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10488
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10257
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9077
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7567
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6808
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4144
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3761
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.