TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 04-23-2009, 05:46 PM   #21 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

Quote:
Originally Posted by allworknoplay View Post
But in PHP you do...

$test = "today\'s a great day";

Do you know if PHP is going to do something like this in the future so we don't have to use backslash if using double quotes?
No you don't. In your example, if you echoed $test, the output would be today\'s a great day, backslash and all.

Look no slashes:
PHP Code:
$test "today's a great day"
Salathe is offline  
Reply With Quote
Old 04-23-2009, 06:02 PM   #22 (permalink)
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

Quote:
Originally Posted by Salathe View Post
No you don't. In your example, if you echoed $test, the output would be today\'s a great day, backslash and all.

Look no slashes:
PHP Code:
$test "today's a great day"

Wow!! I've always thought you had to do that....this is what I mean by fundamentals...and I've read like 50 PHP books and articles....


Anyways, so if you do this, you will get a parse error:


Code:
$test = "<a href="me.html">hey</a>";


echo $test;
So I guess you can't have double quotes within double quotes since the PHP parser doesn't know when to start and end?

<--- Smacks head!!!

I think we need a "smack head" icon....
allworknoplay is offline  
Reply With Quote
Old 04-24-2009, 08:37 AM   #23 (permalink)
The Frequenter
Zend Certified 
 
Join Date: Sep 2007
Location: Denmark
Posts: 352
Thanks: 8
Kalle is on a distinguished road
Default

You only have to escape the type of quotation mark that you are using to define the string with like Salathe said, so you need to escape " if you use double quotation marks for surrounding a string, same for ' :)
__________________
Send a message via MSN to Kalle Send a message via Skype™ to Kalle
Kalle is offline  
Reply With Quote
The Following User Says Thank You to Kalle For This Useful Post:
allworknoplay (04-24-2009)
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 09:56 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design