What is the result of the expression: $a = ‘1’; $b = &$a; $b = ‘2’; echo $a;

PHP Intermediate Hard

PHP Intermediate — Hard

What is the result of the expression: $a = ‘1’; $b = &$a; $b = ‘2’; echo $a;

Key points

  • References point to the same memory address
  • Changes to a reference affect the original variable
  • The & operator creates the reference link

Ready to go further?

Related questions