Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
12-02-2006, 04:58 AM
|
#1
|
Member
Registered: Aug 2005
Posts: 51
Rep:
|
How can I write this sing (') in my php script?
Funny or stupid question, but I'm not PHP programmer, so I hope that someone can help me. I need to insert this sign (') in one of my PHP codes. To be more specific I need for example "rock'n roll" but when I add (') than i get some errors, so i thing that there can be some "code'...
Thanks.
|
|
|
12-02-2006, 06:00 AM
|
#2
|
Senior Member
Registered: May 2001
Location: Indiana
Distribution: Gentoo, Debian, RHEL, Slack
Posts: 1,555
Rep:
|
Ok, I keep trying to put this but it always parses the code. If you use the following five characters, it should give you a single quote
& # 3 9 ;
You do not want spaces between them, but if I write those 5 characters together, this html forum renderes it as the ' rather than the text I want it be show up as.
Last edited by musicman_ace; 12-02-2006 at 06:04 AM.
|
|
|
12-02-2006, 06:57 AM
|
#3
|
Member
Registered: Aug 2005
Posts: 51
Original Poster
Rep:
|
Yes, that works.
Thanks.
Quote:
Originally Posted by musicman_ace
Ok, I keep trying to put this but it always parses the code. If you use the following five characters, it should give you a single quote
& # 3 9 ;
You do not want spaces between them, but if I write those 5 characters together, this html forum renderes it as the ' rather than the text I want it be show up as.
|
|
|
|
12-03-2006, 10:12 PM
|
#4
|
Member
Registered: Sep 2006
Posts: 248
Rep:
|
I think the print "rock'n roll"; should work but if not you can also use this:
PHP Code:
print 'rock\'n roll';
so
\' = '
\" = "
etc...
|
|
|
12-03-2006, 11:14 PM
|
#5
|
Senior Member
Registered: Dec 2003
Distribution: Debian
Posts: 3,178
Rep: 
|
This
PHP Code:
print "rock 'n roll";
is slightly different from this
PHP Code:
print 'rock \'n roll';
though the result is the same, because when you enter text in double quotes it doesn't mean the same thing as in single quotes. Because if you use variables inside double quoted strings, they are parsed for the value and not for single quoted strings.
Last edited by vharishankar; 12-03-2006 at 11:19 PM.
|
|
|
12-04-2006, 07:43 AM
|
#6
|
Member
Registered: Sep 2006
Posts: 248
Rep:
|
Hm... good to know. I don't really know the whys just I know what is working what is not. This is the backdrow of self-education. (^_^) With a tacher I probably knew the difference.
|
|
|
All times are GMT -5. The time now is 09:00 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|