note 80812 added to function.array-values

From: Date: Fri, 01 Feb 2008 11:36:26 +0000
Subject: note 80812 added to function.array-values
Groups: php.notes 
Request: Send a blank email to php-notes+get-135698@lists.php.net to get a copy of this message
<?php /* array array_use_keys ( array $array_data , array $array_keys) */ function array_use_keys(&$array_data, &$array_keys) // pre: $array_data != array(NULL) // post: read only rows from $array_data having values from $array_keys for keys // effective result: array{$array_data[$array_key[0]] .. $array_data[$array_key[n]]} { $resultarray = array(); foreach($array_keys as $key) // $key is the value of a element in $array_keys which is going to be used as a key array_push($resultarray, $array_data[$key]); // note: array_push indexes with integers return($resultarray); } ?> I only found the array_keys, yet it uses string, so I figured since I couldn't find a solution to make one of my own. Hopefully this could make it into the next PHP in a improved array_keys; PS There are no sane errorchecks, so beware. ---- Server IP: 213.249.64.162 Probable Submitter: 194.151.188.222 ---- Manual Page -- http://www.php.net/manual/en/function.array-values.php Edit -- https://master.php.net/note/edit/80812 Del: integrated -- https://master.php.net/note/delete/80812/integrated Del: useless -- https://master.php.net/note/delete/80812/useless Del: bad code -- https://master.php.net/note/delete/80812/bad+code Del: spam -- https://master.php.net/note/delete/80812/spam Del: non-english -- https://master.php.net/note/delete/80812/non-english Del: in docs -- https://master.php.net/note/delete/80812/in+docs Del: other reasons-- https://master.php.net/note/delete/80812 Reject -- https://master.php.net/note/reject/80812 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#135698) next »