1--TEST-- 2Test extract() function (variation 5) 3--FILE-- 4<?php 5 6$mixed_array = array( 7 array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ), 8 array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6, 9 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 ) 10); 11 12$counter = 0; 13 14foreach ( $mixed_array as $sub_array ) { 15 echo "\n-- Iteration $counter --\n"; 16 $counter++; 17 18 var_dump ( extract($sub_array)); /* Single Argument */ 19 20 /* variations of two arguments */ 21 var_dump ( extract($sub_array, EXTR_OVERWRITE)); 22 var_dump ( extract($sub_array, EXTR_SKIP)); 23 var_dump ( extract($sub_array, EXTR_IF_EXISTS)); 24 25 /* variations of three arguments with use of various extract types*/ 26 var_dump ( extract($sub_array, EXTR_PREFIX_INVALID, "ssd")); 27 var_dump ( extract($sub_array, EXTR_PREFIX_SAME, "sss")); 28 var_dump ( extract($sub_array, EXTR_PREFIX_ALL, "bb")); 29 var_dump ( extract($sub_array, EXTR_PREFIX_ALL, "")); // "_" taken as default prefix 30 var_dump ( extract($sub_array, EXTR_PREFIX_IF_EXISTS, "bb")); 31} 32 33echo "Done\n"; 34?> 35--EXPECT-- 36-- Iteration 0 -- 37int(0) 38int(0) 39int(0) 40int(0) 41int(3) 42int(0) 43int(3) 44int(3) 45int(0) 46 47-- Iteration 1 -- 48int(2) 49int(2) 50int(0) 51int(2) 52int(8) 53int(2) 54int(8) 55int(8) 56int(2) 57Done 58