<?php
// input data
$a = 'first';
$b = 'second';
$array = [&$a, &$b];
/**
* Do something with array an return of modified array
* @param string[] $input
* @return array
*/
function doSomething
(array $input) { $result = $input;
foreach ($result as &$val) {
}
return $result;
}
printf('$a=%s $b=%s' . PHP_EOL
, $a, $b); doSomething($array);
printf('$a=%s $b=%s' . PHP_EOL
, $a, $b);
PD9waHAKCi8vIGlucHV0IGRhdGEKJGEgPSAnZmlyc3QnOwokYiA9ICdzZWNvbmQnOwokYXJyYXkgPSBbJiRhLCAmJGJdOwoKLyoqCiAqIERvIHNvbWV0aGluZyB3aXRoIGFycmF5IGFuIHJldHVybiBvZiBtb2RpZmllZCBhcnJheQogKiBAcGFyYW0gc3RyaW5nW10gJGlucHV0CiAqIEByZXR1cm4gYXJyYXkKICovCmZ1bmN0aW9uIGRvU29tZXRoaW5nKGFycmF5ICRpbnB1dCkgewoJJHJlc3VsdCA9ICRpbnB1dDsKCWZvcmVhY2ggKCRyZXN1bHQgYXMgJiR2YWwpIHsKCQkkdmFsID0gc3RyX3JvdDEzKCR2YWwpOwoJfQoJCglyZXR1cm4gJHJlc3VsdDsKfQoKcHJpbnRmKCckYT0lcyAkYj0lcycgLiBQSFBfRU9MLCAkYSwgJGIpOwpkb1NvbWV0aGluZygkYXJyYXkpOwpwcmludGYoJyRhPSVzICRiPSVzJyAuIFBIUF9FT0wsICRhLCAkYik7Cgo=