Since array_combine actually just gives me undefined function errors, I use the following code that I found:
function array_combine_emulated( $keys, $vals ) {
$keys = array_values( (array) $keys );
$vals = array_values( (array) $vals );
$n = max( count( $keys ), count( $vals ) );
$r = array();
for( $i=0; $i<$n; $i++ ) {
$r[ $keys[ $i ] ] = $vals[ $i ];
}
return $r;
}
This does the same thing, and in another script, works perfectly.
I've combined two arrays using:
$F= array_combine_emulated($_POST['A'], $_POST['B']);
If I print_r ($_POST), I'll get:
Array ( [A] => Array ( [0] => [1] => [2] => ) [B] => Array ( [0] => sometext [1] => someothertext [2] => ) => [submit] => submit )
But if I print_r ($F), I'll get:
Array ( [] => )
I know that Array[A][1][2][3] and Array[2] is empty. Could this be why? Not sure if it's needed, but the input values on my form look like this:
<input type="text" name="A[]">
<input type="text" name="B[]">
Can someone shed some light?