PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old July 23rd, 2004, 01:41 PM
fozzyuw fozzyuw is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 8 fozzyuw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 18 m 15 sec
Reputation Power: 0
Clarification about PHP quote marks

Hi,

I notice that both single ( ' ) and double( " ) quote marks can be used in PHP.

I'm wondering if there's any specific rule to using these with MySQL input, PHP , and HTML code or if you can just use whatever you prefer?

Then I'd like to know what people feel is a better PHP coding style to use. As it is, I can't decide if it's better using \" or just ' in side a text string when required quotes inside of quotes kind of deal.

Cheesr,
Fozzy

Reply With Quote
  #2  
Old July 23rd, 2004, 05:36 PM
pentapenguin pentapenguin is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 51 pentapenguin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 36 m 7 sec
Reputation Power: 6
Quote:
Originally Posted by fozzyuw
I notice that both single ( ' ) and double( " ) quote marks can be used in PHP.
Yes.
Either one.

Quote:
Originally Posted by fozzyuw
I'm wondering if there's any specific rule to using these with MySQL input, PHP , and HTML code or if you can just use whatever you prefer?
Here's an example or two (you should be able to figure it out ):
Code:
  <img src="image.jpg" alt="image" title="image">
  $stringWithNoVariables = 'print me out';
  $stringWithVariables = "$x is nice";
  $sqlQuery = "SELECT * FROM table WHERE title = 'title' ";
  


Quote:
Originally Posted by fozzyuw
Then I'd like to know what people feel is a better PHP coding style to use. As it is, I can't decide if it's better using \" or just ' in side a text string when required quotes inside of quotes kind of deal.
Use single quotes (') if you don't have any variables and double (") if you do.
PHP doesn't even look at single quotes (') so the page executes faster.
Hope this helps!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Clarification about PHP quote marks


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway