Closed Thread Icon

Topic awaiting preservation: what in the world is '.=' ? Pages that link to <a href="https://ozoneasylum.com/backlink?for=12810" title="Pages that link to Topic awaiting preservation: what in the world is &amp;#039;.=&amp;#039;  ?" rel="nofollow" >Topic awaiting preservation: what in the world is &#039;.=&#039;  ?\

 
Author Thread
norm
Paranoid (IV) Inmate

From: [s]underwater[/s] under-snow in Juneau
Insane since: Sep 2002

posted posted 07-07-2003 07:29

I'm building a little app using PayPal IPN and the following is in their PHP example code-

$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";

Could someone be kind enough to explain this little snippet of code to me?

.= is not in my PHP books and I've looked at php.net already.

Thanks in advance for clearing up this mystery.

Lurch
Paranoid (IV) Inmate

From: Behind the Wheel
Insane since: Jan 2002

posted posted 07-07-2003 08:54

.= is for appending something to a variable...

$display = "a";
$display .= "b";

the value of $display is now "ab"


Petskull
Maniac (V) Mad Scientist

From: 127 Halcyon Road, Marenia, Atlantis
Insane since: Aug 2000

posted posted 07-07-2003 09:32

basically. this:

$display .= "b";

is equal to this:

$display = $display . "b";

(the period concotinates the strings)

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 07-07-2003 10:31

http://www.php.net/manual/en/language.operators.assignment.php

- you would have found it there, but it is kind of hidden.

Basically, it's an assignment that has the sideeffect of concenating two strings.

And yes, the dot (.) is a pretty dumb idea for any control character in a language.
It's exactly two-by-two pixels wide, and this *after* I increased the font size.
Now, go find a missing dot on a 1600x1200 screen ;-)

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

posted posted 07-07-2003 12:19

it's the magical dot

Skaarjj
Maniac (V) Mad Scientist

From: :morF
Insane since: May 2000

posted posted 07-07-2003 12:23

You swallow it and it makes the world go all funny. See, years ago we came up with a better way to distribute our black pills so they are all disguised as dots now...now there's all over the web...

Err...I shouldn't have told you that...

Going to have to kill you now....

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted posted 07-07-2003 14:14

Tyberius Prime: I don't think it's that hidden. Norm was looking for an operator, he might have had a look in the documentation or have output his value before and after the mysterious line. Whatever.

Regarding your note about the screen size of the dot. On french keyboards the ; and the : are on two consecutive keys, thus it's easy to make a typo. And I often end up trying to figure exactly where are those 2-3 missing pixels ... where a simple regex-replacement should fix my problem

Mathieu "POÏ" HENRI

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 07-07-2003 14:31

And to clarify:

PS:

quote:
concotinates



TP:

quote:
concenating



Its actually concatenate (and concatenating) from the Latin for chain and it basically allows you create a 'chain' by adding in various 'links'. It is also a pain to spell as I have had to change the spelling twice in this post

___________________
Emps

FAQs: Emperor

norm
Paranoid (IV) Inmate

From: [s]underwater[/s] under-snow in Juneau
Insane since: Sep 2002

posted posted 07-07-2003 16:37

Thanks!

I knew that the '.' was used to concatonate, but I wasn't sure if it did so when used with the '=' It looks like the answer is 'Yes'

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 07-07-2003 17:38

well, I consider such a statement:

"In addition to the basic assignment operator, there are "combined operators" for all of the binary arithmetic and string operators that allow you to use a value in an expression and then set its value to the result of that expression."

without having a list of them (how hard could it have been? They're right there in the code of php, just copy paste 'em...),
to be at least slightly hidden and unworthy of the otherwise good php documentation.

« BackwardsOnwards »

Show Forum Drop Down Menu