This "=&" operator, I need some clarification, it seems the lesson provided is lacking some explanation

This is my code for the lesson

<?php
/* Imagine a lot of code here */  
  $very_bad_unclear_name = "15 chicken wings";

// Write your code here:

$order =& $very_bad_unclear_name;
    $order.="\nThis is your Order";
  // Don't change the line below
  echo "\nYour order is: $very_bad_unclear_name.";

I don’t understand when I assigned “.=” or just “=” on the alias variable, the $very_bad_unclear_name also change its value

So from my understanding, when the alias variable using “=&” operator, the original variable’s value also changes?

sounds like assignment by reference:

PHP: Assignment Operators - Manual

can’t find what else it could be? But this is often written like this:

$order = &$very_bad_unclear_name;

so variables (like $very_bad_unclear_name ) are labels which allow us to access the string ( 15 chicken wings ) stored in memory. Assignment by reference means you have another variable/label pointing to the same string in memory.

Given both variables reference/point to the same string in memory, any changes made to the string (in memory), will “change” both variables (change between quotes here, because its not really accurate)

but I hope you get it by now :slight_smile:

Given both variables reference/point to the same string in memory, any changes made to the string (in memory), will “change”

Now I get it! Thank you!