csplrj Posted June 5, 2007 Share Posted June 5, 2007 Is there any Function by which I have the associative array (1=>'a','b','c','d') and the keys to show (1,2) i.e. and the result should be ('a','b')? PHP Function is also Ok But If I get smarty tag then i would be grateful i.e. a function by which if I give the input Input --------- associative array (1=>'a','b','c','d') (1,2) OutPut -------- ('a','b') Bye for now CSJakharia Link to comment https://forums.phpfreaks.com/topic/54257-is-there-any-function-by-which-i-have-the-associative-array-1abcd/ Share on other sites More sharing options...
zq29 Posted June 5, 2007 Share Posted June 5, 2007 Basic idea to show theory, could be refined though. <?php function return_vals($in,$return) { $out = array(); $r = explode(",",$return); foreach($r as $x) $out[] = $in[$x]; return $out; } ?> Link to comment https://forums.phpfreaks.com/topic/54257-is-there-any-function-by-which-i-have-the-associative-array-1abcd/#findComment-268266 Share on other sites More sharing options...
csplrj Posted June 5, 2007 Author Share Posted June 5, 2007 So There is no direct function for the same.? Anyway Thanks for this Bye for now CSJakharia Link to comment https://forums.phpfreaks.com/topic/54257-is-there-any-function-by-which-i-have-the-associative-array-1abcd/#findComment-268295 Share on other sites More sharing options...
chigley Posted June 5, 2007 Share Posted June 5, 2007 Have you looked at the range() function? Link to comment https://forums.phpfreaks.com/topic/54257-is-there-any-function-by-which-i-have-the-associative-array-1abcd/#findComment-268311 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.