Send the values in an array to a user-defined function and return a string:


SUBMITTED BY: henry1874w

DATE: June 25, 2017, 2:38 p.m.

FORMAT: Text only

SIZE: 143 Bytes

HITS: 213

  1. <?php
  2. function myfunction($v1,$v2)
  3. {
  4. return $v1 . "-" . $v2;
  5. }
  6. $a=array("Dog","Cat","Horse");
  7. print_r(array_reduce($a,"myfunction"));
  8. ?>

comments powered by Disqus