1--TEST-- 2Test extract() function (variation 2) 3--FILE-- 4<?php 5 6/* various combinations of arrays to be used for the test */ 7$mixed_array = array( 8 array(), 9 array( 1,2,3,4,5,6,7,8,9 ), 10 array( "One", "Two", "Three", "Four", "Five" ), 11); 12 13$counter = 0; 14 15foreach ( $mixed_array as $sub_array ) { 16 echo "\n-- Iteration $counter --\n"; 17 $counter++; 18 19 var_dump ( extract($sub_array)); /* Single Argument */ 20 21 /* variations of two arguments */ 22 var_dump ( extract($sub_array, EXTR_OVERWRITE)); 23 var_dump ( extract($sub_array, EXTR_SKIP)); 24 var_dump ( extract($sub_array, EXTR_IF_EXISTS)); 25 26 /* variations of three arguments with use of various extract types*/ 27 var_dump ( extract($sub_array, EXTR_PREFIX_INVALID, "ssd")); 28 var_dump ( extract($sub_array, EXTR_PREFIX_SAME, "sss")); 29 var_dump ( extract($sub_array, EXTR_PREFIX_ALL, "bb")); 30 var_dump ( extract($sub_array, EXTR_PREFIX_ALL, "")); // "_" taken as default prefix 31 var_dump ( extract($sub_array, EXTR_PREFIX_IF_EXISTS, "bb")); 32} 33 34echo "Done\n"; 35?> 36--EXPECTF-- 37-- Iteration 0 -- 38int(0) 39int(0) 40int(0) 41int(0) 42int(0) 43int(0) 44int(0) 45int(0) 46int(0) 47 48-- Iteration 1 -- 49int(0) 50int(0) 51int(0) 52int(0) 53int(9) 54int(0) 55int(9) 56int(9) 57int(0) 58 59-- Iteration 2 -- 60int(0) 61int(0) 62int(0) 63int(0) 64int(5) 65int(0) 66int(5) 67int(5) 68int(0) 69Done 70