PHP中变量括号的内容是什么?

I am using ImageMagick in PHP 5.3 on an old platform. I stumbled upon a piece of code which was not working when parentheses were used around a variable, but did work when these parentheses were removed. What do parentheses around a variable do?

$im = new imagick();
$im->readImageBlob($photo);
$im->setImageFormat('jpg');
$photo = ($im);

It did not read the image data with this code, but it did when I removed the parentheses.

$photo = $im;

Any ideas?

Parentheses around a variable are just for precedence and usually used in calculations. With the code you're showing, there's absolutely no functional difference between $photo = $im; and $photo = ($im);

For example:

$x = 2;
$y = 5;
$z = 10;
$result_1 = $x * $y + $z; //might not give you the result you expect.
$result_2 = $x * ($y + $z); //This will ensure that $y & $z get added before multiplying by $x.

The above is what parentheses are normally used for.