fork(1) download
  1. <?php
  2.  
  3. // input data
  4. $a = 'first';
  5. $b = 'second';
  6. $array = [&$a, &$b];
  7.  
  8. /**
  9.  * Do something with array an return of modified array
  10.  * @param string[] $input
  11.  * @return array
  12.  */
  13. function doSomething(array $input) {
  14. $result = $input;
  15. foreach ($result as &$val) {
  16. $val = str_rot13($val);
  17. }
  18.  
  19. return $result;
  20. }
  21.  
  22. printf('$a=%s $b=%s' . PHP_EOL, $a, $b);
  23. doSomething($array);
  24. printf('$a=%s $b=%s' . PHP_EOL, $a, $b);
  25.  
  26.  
Success #stdin #stdout 0.01s 82880KB
stdin
Standard input is empty
stdout
$a=first $b=second
$a=svefg $b=frpbaq