1--TEST-- 2Test php_uname() function - usage variations 3--FILE-- 4<?php 5/* Prototype: string php_uname ([ string $mode ] ) 6 * Description: Returns information about the operating system PHP is running on 7*/ 8 9echo "*** Testing php_uname() - usage variations\n"; 10// Prevent notices about undefines variables 11error_reporting(E_ALL & ~E_NOTICE); 12 13$unset_var = 10; 14unset ($unset_var); 15 16class fooClass { 17 function __toString() { 18 return "m"; 19 } 20} 21 22$values = array( 23 24 // int data 25 "0" => 0, 26 "1" => 1, 27 "12345" => 12345, 28 "-2345" => -2345, 29 30 // float data 31 "10.5" => 10.5, 32 "-10.5" => -10.5, 33 "10.1234567e10" => 10.1234567e10, 34 "10.7654321E-10" => 10.7654321E-10, 35 ".5" => .5, 36 37 // null data 38 "NULL" => NULL, 39 "null" => null, 40 41 // boolean data 42 "true" => true, 43 "false" => false, 44 "TRUE" => TRUE, 45 "FALSE" => FALSE, 46 47 // empty data 48 "\"\"" => "", 49 "''" => '', 50 51 // object data 52 "new fooClass()" => new fooClass(), 53 54 // undefined data 55 "undefined var" => $undefined_var, 56 57 // unset data 58 "unset var" => $unset_var, 59); 60 61// loop through each element of the array for data 62 63foreach($values as $key => $value) { 64 echo "-- Iterator $key --\n"; 65 var_dump( php_uname($value) ); 66}; 67 68?> 69===DONE=== 70--EXPECTF-- 71*** Testing php_uname() - usage variations 72-- Iterator 0 -- 73string(%d) "%s" 74-- Iterator 1 -- 75string(%d) "%s" 76-- Iterator 12345 -- 77string(%d) "%s" 78-- Iterator -2345 -- 79string(%d) "%s" 80-- Iterator 10.5 -- 81string(%d) "%s" 82-- Iterator -10.5 -- 83string(%d) "%s" 84-- Iterator 10.1234567e10 -- 85string(%d) "%s" 86-- Iterator 10.7654321E-10 -- 87string(%d) "%s" 88-- Iterator .5 -- 89string(%d) "%s" 90-- Iterator NULL -- 91string(%d) "%s" 92-- Iterator null -- 93string(%d) "%s" 94-- Iterator true -- 95string(%d) "%s" 96-- Iterator false -- 97string(%d) "%s" 98-- Iterator TRUE -- 99string(%d) "%s" 100-- Iterator FALSE -- 101string(%d) "%s" 102-- Iterator "" -- 103string(%d) "%s" 104-- Iterator '' -- 105string(%d) "%s" 106-- Iterator new fooClass() -- 107string(%d) "%s" 108-- Iterator undefined var -- 109string(%d) "%s" 110-- Iterator unset var -- 111string(%d) "%s" 112===DONE===