====== Passing by Reference ====== Explained better by this [[https://www.php.net/manual/en/language.references.pass.php|PHP article]]. Passing a parameter by reference is useful if you want to pass a parameter and edit it without having to return it. You define a parameter with reference with the ''&'' symbol like so: $johnLennon = [ 'alive' => true, 'name' => 'John Lennon', ]; function kill(array &$toBeKilled): void { $toBeKilled['alive'] = false; } kill($johnLennon); // John Lennon now looks like this: // $johnLennon = [ // 'alive' => false, // 'name' => 'John Lennon', // ]; debug($johnLennon); Many PHP array functions also use this, so you don't have to keep overwriting your variables after doing an action on the array like adding an element. Example [[https://www.php.net/manual/en/function.array-unshift.php|array_unshift]].