I have an array like below format:
Array(
        [0] => 25/1
        [1] => 10/1
     );
But I want to convert the array so it would look like below format
Array(
            [0] => "25/1"
            [1] => "10/1"
         );
I have already tried lots of things about this issue but can’t get the desire solution yet.
Anybody help please ?
Advertisement
Answer
If you really need to wrap array values in double quotes, here is a simple method with array_map():
$current_array = array(red, green);
$new_array = array();
$new_array  = array_map(function($rec){
//concatenate record with "" 
$result = $rec= '"'.$rec.'"';
return $result;
},$current_array);
print_r($result);
Output will be:
Array ( [0] => "red" [1] => "green" )