Voting

: min(one, seven)?
(Example: nine)

The Note You're Voting On

Dan LaManna
13 years ago
I needed a function that truncated extra values, and only went as far as keys without throwing a warning as array_combine does.

<?php
function safeArrayCombine($keys, $values) {
$combinedArray = array();

for (
$i=0, $keyCount = count($keys); $i < $keyCount; $i++) {
$combinedArray[$keys[$i]] = $values[$i];
}

return
$combinedArray;
}
?>

<< Back to user notes page

To Top