import zend standard tests
[hiphop-php.git] / hphp / test / zend / good / ext-standard-array / array_map_error.php
blob729423577af397d1a6643e388d07eec60119a804
1 <?php
2 /* Prototype : array array_map ( callback $callback , array $arr1 [, array $... ] )
3 * Description: Applies the callback to the elements of the given arrays
4 * Source code: ext/standard/array.c
5 */
7 echo "*** Testing array_map() : error conditions ***\n";
9 // Zero arguments
10 echo "\n-- Testing array_map() function with Zero arguments --\n";
11 var_dump( array_map() );
13 // Testing array_map with one less than the expected number of arguments
14 echo "\n-- Testing array_map() function with one less than expected no. of arguments --\n";
15 function callback1() {
16 return 1;
18 var_dump( array_map('callback1') );
20 echo "\n-- Testing array_map() function with less no. of arrays than callback function arguments --\n";
21 $arr1 = array(1, 2);
22 function callback2($p, $q) {
23 return $p * $q;
25 var_dump( array_map('callback2', $arr1) );
27 echo "\n-- Testing array_map() function with more no. of arrays than callback function arguments --\n";
28 $arr2 = array(3, 4);
29 $arr3 = array(5, 6);
30 var_dump( array_map('callback2', $arr1, $arr2, $arr3) );
32 echo "Done";