1--TEST-- 2Test var_export() function with valid arrays 3--INI-- 4serialize_precision=17 5--FILE-- 6<?php 7echo "*** Testing var_export() with valid arrays ***\n"; 8// different valid arrays 9$valid_arrays = array( 10 "array()" => array(), 11 "array(NULL)" => array(NULL), 12 "array(null)" => array(null), 13 "array(true)" => array(true), 14 "array(\"\")" => array(""), 15 "array('')" => array(''), 16 "array(array(), array())" => array(array(), array()), 17 "array(array(1, 2), array('a', 'b'))" => array(array(1, 2), array('a', 'b')), 18 "array(1 => 'One')" => array(1 => 'One'), 19 "array(\"test\" => \"is_array\")" => array("test" => "is_array"), 20 "array(0)" => array(0), 21 "array(-1)" => array(-1), 22 "array(10.5, 5.6)" => array(10.5, 5.6), 23 "array(\"string\", \"test\")" => array("string", "test"), 24 "array('string', 'test')" => array('string', 'test') 25); 26 27/* Loop to check for above arrays with var_export() */ 28echo "\n*** Output for arrays ***\n"; 29foreach($valid_arrays as $key => $arr) { 30 echo "\n--Iteration: $key --\n"; 31 var_export( $arr ); 32 echo "\n"; 33 var_export( $arr, FALSE); 34 echo "\n"; 35 var_dump( var_export( $arr, TRUE) ); 36 echo "\n"; 37} 38?> 39--EXPECT-- 40*** Testing var_export() with valid arrays *** 41 42*** Output for arrays *** 43 44--Iteration: array() -- 45array ( 46) 47array ( 48) 49string(9) "array ( 50)" 51 52 53--Iteration: array(NULL) -- 54array ( 55 0 => NULL, 56) 57array ( 58 0 => NULL, 59) 60string(22) "array ( 61 0 => NULL, 62)" 63 64 65--Iteration: array(null) -- 66array ( 67 0 => NULL, 68) 69array ( 70 0 => NULL, 71) 72string(22) "array ( 73 0 => NULL, 74)" 75 76 77--Iteration: array(true) -- 78array ( 79 0 => true, 80) 81array ( 82 0 => true, 83) 84string(22) "array ( 85 0 => true, 86)" 87 88 89--Iteration: array("") -- 90array ( 91 0 => '', 92) 93array ( 94 0 => '', 95) 96string(20) "array ( 97 0 => '', 98)" 99 100 101--Iteration: array('') -- 102array ( 103 0 => '', 104) 105array ( 106 0 => '', 107) 108string(20) "array ( 109 0 => '', 110)" 111 112 113--Iteration: array(array(), array()) -- 114array ( 115 0 => 116 array ( 117 ), 118 1 => 119 array ( 120 ), 121) 122array ( 123 0 => 124 array ( 125 ), 126 1 => 127 array ( 128 ), 129) 130string(55) "array ( 131 0 => 132 array ( 133 ), 134 1 => 135 array ( 136 ), 137)" 138 139 140--Iteration: array(array(1, 2), array('a', 'b')) -- 141array ( 142 0 => 143 array ( 144 0 => 1, 145 1 => 2, 146 ), 147 1 => 148 array ( 149 0 => 'a', 150 1 => 'b', 151 ), 152) 153array ( 154 0 => 155 array ( 156 0 => 1, 157 1 => 2, 158 ), 159 1 => 160 array ( 161 0 => 'a', 162 1 => 'b', 163 ), 164) 165string(107) "array ( 166 0 => 167 array ( 168 0 => 1, 169 1 => 2, 170 ), 171 1 => 172 array ( 173 0 => 'a', 174 1 => 'b', 175 ), 176)" 177 178 179--Iteration: array(1 => 'One') -- 180array ( 181 1 => 'One', 182) 183array ( 184 1 => 'One', 185) 186string(23) "array ( 187 1 => 'One', 188)" 189 190 191--Iteration: array("test" => "is_array") -- 192array ( 193 'test' => 'is_array', 194) 195array ( 196 'test' => 'is_array', 197) 198string(33) "array ( 199 'test' => 'is_array', 200)" 201 202 203--Iteration: array(0) -- 204array ( 205 0 => 0, 206) 207array ( 208 0 => 0, 209) 210string(19) "array ( 211 0 => 0, 212)" 213 214 215--Iteration: array(-1) -- 216array ( 217 0 => -1, 218) 219array ( 220 0 => -1, 221) 222string(20) "array ( 223 0 => -1, 224)" 225 226 227--Iteration: array(10.5, 5.6) -- 228array ( 229 0 => 10.5, 230 1 => 5.5999999999999996, 231) 232array ( 233 0 => 10.5, 234 1 => 5.5999999999999996, 235) 236string(49) "array ( 237 0 => 10.5, 238 1 => 5.5999999999999996, 239)" 240 241 242--Iteration: array("string", "test") -- 243array ( 244 0 => 'string', 245 1 => 'test', 246) 247array ( 248 0 => 'string', 249 1 => 'test', 250) 251string(41) "array ( 252 0 => 'string', 253 1 => 'test', 254)" 255 256 257--Iteration: array('string', 'test') -- 258array ( 259 0 => 'string', 260 1 => 'test', 261) 262array ( 263 0 => 'string', 264 1 => 'test', 265) 266string(41) "array ( 267 0 => 'string', 268 1 => 'test', 269)" 270 271