---
title: "Scrappy coding! Assigning the return value of new by reference is deprecated"
date: "2013-06-10"
path: "/143-scrappy-coding-assigning-the-return-value-of-new-by-reference-is-deprecated.html"
section: "/ramblings"
aliases:
  - "/143"
  - "/143-scrappy-coding-assigning-the-return-value-of-new-by-reference-is-deprecated"
  - "/143.html"
  - "/ramblings/143-scrappy-coding-assigning-the-return-value-of-new-by-reference-is-deprecated.html"
---

We run a number of Joomla, Wordpress and Magento sites and with 3rd party extensions this crops up now and again:

```
Assigning the return value of new by reference is deprecated
```

PHP 5 has numerous improvements plus the obvious highlighted by the error which is that the following snippet:

```
$gallery =& new YOOGallery($params);
echo $gallery->render();
```

Just needs to be fixed by removing the PHP reference "&":

```
$gallery = new YOOGallery($params);
echo $gallery->render();
```
