PageRenderTime 22ms CodeModel.GetById 18ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/hphp/test/zend/good/ext/standard/tests/array/array_unique_error.php

http://github.com/facebook/hiphop-php
PHP | 20 lines | 11 code | 3 blank | 6 comment | 0 complexity | 83fb655b3de37fd593b793a0ab50d076 MD5 | raw file
 1<?hh
 2/* Prototype  : array array_unique(array $input)
 3 * Description: Removes duplicate values from array 
 4 * Source code: ext/standard/array.c
 5*/
 6<<__EntryPoint>> function main(): void {
 7echo "*** Testing array_unique() : error conditions ***\n";
 8
 9// Zero arguments
10echo "\n-- Testing array_unique() function with zero arguments --\n";
11try { var_dump( array_unique() ); } catch (Exception $e) { echo "\n".'Warning: '.$e->getMessage().' in '.__FILE__.' on line '.__LINE__."\n"; }
12
13//Test array_unique with one more than the expected number of arguments
14echo "\n-- Testing array_unique() function with more than expected no. of arguments --\n";
15$input = varray[1, 2];
16$extra_arg = 10;
17try { var_dump( array_unique($input, SORT_NUMERIC, $extra_arg) ); } catch (Exception $e) { echo "\n".'Warning: '.$e->getMessage().' in '.__FILE__.' on line '.__LINE__."\n"; }
18
19echo "Done";
20}