onlyican Posted August 2, 2006 Share Posted August 2, 2006 YoI am going brain dead I think, I swear I done this before, But I cant remember howI have an array with multiple things in there, including itemsI call these by$item1 = $keyarray['item1'];$item2 = $keyarray['item2'];NowI want to make these items into a new arrayso I wont use item1 item2I would use an array called items, and end up with a finish result, something likeArray ( [0] => prod1 [1] => prod2 )How do I do this again?Thanks in advance Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted August 2, 2006 Share Posted August 2, 2006 If I understand what you're looking for, try this:[code]<?php$items = array();foreach ($keyarray as $k => $v) $items[] = $v;echo '<pre>' . print_r($items,true) . '</pre>'; // just to see what's in the array?>[/code]Ken Quote Link to comment Share on other sites More sharing options...
onlyican Posted August 2, 2006 Author Share Posted August 2, 2006 That would not work as there are loads of things in the key arrayI only wanted items.Brain clicked infor($i = 0; $i < $num_items; $i++){$prod = $i +1;$item_name[$i] = $keyarray["item_name".$prod];} Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.