import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-math / base_convert_variation1.php
blob6baa5ae9df1a8574293acced1b659be15f43ada5
1 <?php
2 /* Prototype : string base_convert ( string $number , int $frombase , int $tobase )
3 * Description: Convert a number between arbitrary bases.
4 * Source code: ext/standard/math.c
5 */
7 echo "*** Testing base_convert() : usage variations ***\n";
9 //get an unset variable
10 $unset_var = 10;
11 unset ($unset_var);
13 // heredoc string
14 $heredoc = <<<EOT
15 abc
16 xyz
17 EOT;
19 // get a resource variable
20 $fp = fopen(__FILE__, "r");
22 $inputs = array(
23 // int data
24 /*1*/ 0,
26 12,
27 -12,
28 2147483647,
30 // float data
31 /*6*/ 10.5,
32 -10.5,
33 1.234567e2,
34 1.234567E-2,
35 .5,
37 // null data
38 /*11*/ NULL,
39 null,
41 // boolean data
42 /*13*/ true,
43 false,
44 TRUE,
45 FALSE,
47 // empty data
48 /*17*/ "",
49 '',
50 array(),
52 // string data
53 /*20*/ "abcxyz",
54 'abcxyz',
55 $heredoc,
57 // undefined data
58 /*23*/ @$undefined_var,
60 // unset data
61 /*24*/ @$unset_var,
63 // resource variable
64 /*25*/ $fp
67 // loop through each element of $inputs to check the behaviour of base_convert()
68 $iterator = 1;
69 foreach($inputs as $input) {
70 echo "\n-- Iteration $iterator --\n";
71 var_dump(base_convert($input, 10, 8));
72 $iterator++;
74 fclose($fp);
76 ===Done===