cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: Quotes: Single, double, and NONE

From: <simon_at_ice.org>
Date: Sat, 27 Oct 2007 17:50:14 +0200

Apologies for the top post.
I can guarantee that before I posted, just to be sure, I tried every
variation that I posted, and ran them through the Zend IDE debugger,
with exactly the same result each time.
Product PHP might be different, but I'd be surprised.

Colleen R. Dick wrote:
> People:
> Back to PHP basics: PHP is flawed but not *THAT* flawed.
> (apologies to most of you who know this) here is how it rolls.
> Double quotes and single treat embedded variables differently.
> "foo" and 'foo' happen to be the same because
> there is no variable in it. For this reason single quotes are more
> efficient.
> However if $a == 1 then "foo$a" evaluates to foo1 and 'foo$a' is just
> foo$a
>
> In the case of curl declarations, CONSTANTS like CURLOPT_PUT are
> arbitrary constants defined in the curl module and substituted
> textually. Someone may be passing actual arg strings such as post
> var strings that have no embedded variables and getting away with not
> knowing the difference between single and double, but for constants that
> will not fly. You DON'T quote them at all single or double.
>
> The constant strings are used
> both for human legibility and maintainability of the module. Normally we
> don't care what it is.
>
> You can test if you print CURLOPT_PUT; and print "CURLOPT_PUT";
> there will be a difference.
>
> On Sat, 2007-10-27 at 15:31 +0200, Daniel Stenberg wrote:
>
>> On Sat, 27 Oct 2007, simon_at_ice.org wrote:
>>
>>
>>> I can attest using single or double quotes in curl declarations in PHP make
>>> no difference.
>>>
>> So are you saying that in PHP land the following two lines are identical?
>>
>> curl_setopt($c, "CURLOPT_PUT", "TRUE");
>>
>> curl_setopt($c, CURLOPT_PUT, TRUE);
>>
>>
>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2007-10-27