update page now

Voting

: min(four, four)?
(Example: nine)

The Note You're Voting On

Ehsan.Chavoshi.com
6 years ago
I wrote this function to recursively replace array keys with array values (flip) and fill values with defined value. it can be used for recursive array intersect functions .

<?php
function array_values_to_keys_r($array, $fill_value = null)
{
    $flipped = [];
    foreach ($array as $key => $value) {
        if (is_array($value)) {
            $flipped [$key] = array_values_to_keys_r($value);
        } else {
            $flipped [$value] = $fill_value;
        }
    }
    return $flipped;
}
?>

<< Back to user notes page

To Top