php pass by reference
snippet in php

php pass by reference

user7810

<?php
function appendToString(&$string)
{
    $string .= 'Cool Im appended';
}

$str = 'I am a start and - ';
appendToString($str);
echo $str;    // outputs 'I am a start and - Cool Im appended'
?>

javascript pass by reference

user6397

function add(a, b, output) {
  output.out = a + b;
}

var output = {};
add(5, 3, output);
console.log(output); //output: {out: 8}