0

My data is in this format. I want it without wishlist_id, means simple values. How to change the array values?

Array ( [0] => Array ( [wishlist_id] => 35 ) [1] => Array ( [wishlist_id] => 36 ) [2] => Array ( [wishlist_id] => 38 ) [3] => Array ( [wishlist_id] => 39 ) [4] => Array ( [wishlist_id] => 42 ) [5] => Array ( [wishlist_id] => 43 ) [6] => Array ( [wishlist_id] => 45 ) [7] => Array ( [wishlist_id] => 48 ) [8] => Array ( [wishlist_id] => 50 ) [9] => Array ( [wishlist_id] => 52 ) [10] => Array ( [wishlist_id] => 53 ) [11] => Array ( [wishlist_id] => 55 ) [12] => Array ( [wishlist_id] => 57 ) [13] => Array ( [wishlist_id] => 59 ) [14] => Array ( [wishlist_id] => 60 ) [15] => Array ( [wishlist_id] => 63 ) [16] => Array ( [wishlist_id] => 66 ) [17] => Array ( [wishlist_id] => 67 ) [18] => Array ( [wishlist_id] => 69 ) [19] => Array ( [wishlist_id] => 70 ) [20] => Array ( [wishlist_id] => 73 ) [21] => Array ( [wishlist_id] => 75 ) [22] => Array ( [wishlist_id] => 76 ) [23] => Array ( [wishlist_id] => 78 ) [24] => Array ( [wishlist_id] => 80 ) [25] => Array ( [wishlist_id] => 83 ) [26] => Array ( [wishlist_id] => 85 ) ) 

2 Answers 2

0

Try this:

echo '<pre>'; $twoDimensionalArray = array(array('wishlist_id' => 35),array('wishlist_id' => 40),array('wishlist_id' => 50)); $oneDimensionalArray = array_map('current', $twoDimensionalArray); print_r($oneDimensionalArray); 
0

get values by

foreach ($wardrobe_ids as $item){ echo $wishlist = $item[wishlist_id]; } 

I hope this will help you.

7
  • $wardrobe_ids = $mysql->getAll("Select wishlist_id from customer_wishlists where type='wardrobe'"); print_r($wardrobe_ids); I am using this Commented Jan 4, 2016 at 10:35
  • 'print_r($wardrobe_ids->getData());' use this. Commented Jan 4, 2016 at 10:37
  • its giviing me error Commented Jan 4, 2016 at 10:40
  • check updated answer this will help you. Commented Jan 4, 2016 at 10:52
  • i need it without loop Commented Jan 4, 2016 at 10:54

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.