Home » Php » php – What does "&" mean in this case?

php – What does "&" mean in this case?

Posted by: admin July 12, 2020 Leave a comment

Questions:

I know that it’s creating a reference in other cases. But what happens here?

$crawler = &new MyCrawler();
How to&Answers:

It creates an instance of MyCrawler and passes the reference for that instance into $crawler. In PHP5 this is assumed so the use of the & is deprecated.

See Object References (the Ampersand).

Answer:

That is deprecated per the PHP documentation