PageRenderTime 73ms CodeModel.GetById 70ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://github.com/facebook/hiphop-php
PHP | 33 lines | 16 code | 6 blank | 11 comment | 0 complexity | 9f8a2e57e665432c36e19d6c728a999a MD5 | raw file
 1<?php
 2/* Prototype  : proto array compact(mixed var_names [, mixed ...])
 3 * Description: Creates a hash containing variables and their values 
 4 * Source code: ext/standard/array.c
 5 * Alias to functions: 
 6 */
 7
 8/*
 9 * Test basic functionality
10 */
11
12echo "*** Testing compact() : basic functionality ***\n";
13
14$a=1;
15$b=0.2;
16$c=true;
17$d=array("key"=>"val");
18$e=NULL;
19$f="string";
20
21// simple array test
22var_dump (compact(array("a", "b", "c", "d", "e", "f")));
23// simple parameter test
24var_dump (compact("a", "b", "c", "d", "e", "f"));
25var_dump (compact(array("keyval"=>"a", "b"=>"b", "c"=>1)));
26
27// cases which should not yield any output.
28var_dump (compact(array(10, 0.3, true, array(20), NULL)));
29var_dump (compact(10, 0.3, true, array(20), NULL));
30var_dump (compact(array("g")));
31
32echo "Done";
33?>