Source for file utility.php

Documentation is available at utility.php


1 <?php
2 /**
3 * Example included file with utility functions
4 * @author Derick Rethans <derick@php.net>
5 * @version $Id: $
6 * @package PHPDocExample
7 * @subpackage PHPDocExampleFunctions
8 */
9
10 /**
11 * Function to add numbers in arrays
12 *
13 * This function returns an array in which every element is the sum of the
14 * two corresponding elements in the input arrays.
15 * @since Version 0.9
16 * @param array $array1 The first input array
17 * @param array $array2 The second input array
18 * @return array
19 */
20 function sumElements ($array1, $array2)
21 {
22 $ret = $array1;
23
24 foreach ($array2 as $key => $element) {
25 if (isset ($ret[$key])) {
26 $ret[$key] += $element;
27 } else {
28 $ret[$key] = $element;
29 }
30 }
31 return $ret;
32 }
33 ?>

Documentation generated on Tue, 18 Nov 2003 18:03:45 +0100 by phpDocumentor 1.2.2