note 62341 deleted from function.sort by cmb

From: Date: Sun, 27 Oct 2019 08:36:56 +0000
Subject: note 62341 deleted from function.sort by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-212792@lists.php.net to get a copy of this message
Note Submitter: ludvig dot ericson at gmail dot com ---- A tip for those who like "raul at jimi dot com dot mx" need to preserve keys after changing stuff in the middle of an array: array_values. Example: <?php $array = array(1, 2, 5, 9, 3); unset($array[3]); // Remove index 3, which is 9. $array = array_values($array); ?> Hint: array_values can be fine for removing keys and reindex them by number instead, too (applies to functions like posix_pwgetuid which returns an associative array, unlike C and others, call array_values on it, and it'll be the same format IIRC.)

« previous php.notes (#212792) next »