I am having an array like :
array
(
  ['fruit1'] => banana,
  ['fruit2'] => apple,
  ['fruit3'] => grapes,
  ['fruit4'] => orange 
)
And I want the array Like :
array(banana,apple,grapes,orange);
Please suggest how can I convert it.
I am having an array like :
array
(
  ['fruit1'] => banana,
  ['fruit2'] => apple,
  ['fruit3'] => grapes,
  ['fruit4'] => orange 
)
And I want the array Like :
array(banana,apple,grapes,orange);
Please suggest how can I convert it.
 
    
    You can use
$new_array = array_values($your_array);
Note: You dont need commas after banana, apple and grapes in the main array.
 
    
    Try this
<?php 
echo "<pre>";
$arr = array('fruit1'=>'banana','fruit2'=>'apple','fruit3'=>'grapes','fruit4'=>'orange');
$new = array_values($arr);
print_r($new);
For more info about array_values please read http://php.net/manual/en/function.array-values.php
Output
Array
(
    [0] => banana
    [1] => apple
    [2] => grapes
    [3] => orange
)
