Jump to content

add a dot before the equal in php


sungpeng

Recommended Posts

The dot equals (.=) is a shortcut:

// The following:
$something .= $more;

// Is the same as the following:
$something = $something . $more;

Without the dot, whatever is in the variable will be replaced.

$something="this";
$something = "that"; // now $something is 'that'
$something .= "more"; // now $something is 'thatmore'

It depends on what you are trying to do.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.