note 93611 deleted from function.array-values by crell

From: Date: Tue, 12 Apr 2022 01:05:42 +0000
Subject: note 93611 deleted from function.array-values by crell
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-218191@lists.php.net to get a copy of this message
Note Submitter: karl dot rixon at gmail dot com ---- A modification of wellandpower at hotmail.com's function to perform array_values recursively. This version will only re-index numeric keys, leaving associative array indexes alone. <?php function array_values_recursive($array) { $temp = array(); foreach ($array as $key => $value) { if (is_numeric($key)) { $temp[] = is_array($value) ? array_values_recursive($value) : $value; } else { $temp[$key] = is_array($value) ? array_values_recursive($value) : $value; } } return $temp; } ?>

« previous php.notes (#218191) next »