0
I’m trying to create a function that stores the values of an array in a . csv file, but inside the . csv is stored only the level of the parent array, for example:  ArrayArrayArrayArrayArrayArray.
The code of the function:
function convert_data_to_csv( $data ) {
    $content = array();
    foreach ( $data as $array ) {
        foreach ( $array as $row ) {
            $content .= $row;
            file_put_contents( 'http://127.0.0.1/proj/src/csv/certificados.csv', $content );
        }
    }
}
The array data passed as a function parameter are:
array(2) {
  [0]=>
  array(3) {
    [0]=>
    array(2) {
      ["fruta"]=>
      string(6) "banana"
      ["cor"]=>
      string(4) "azul"
    }
    [1]=>
    array(2) {
      ["fruta"]=>
      string(4) "maçã"
      ["cor"]=>
      string(5) "verde"
    }
  }
How can I modify the function code to return . csv with each array value in a cell? Like in this example:
banana,azul
maçã,verde
I put one more foreach in the array, but it returns the csv with the data in the same cell:
bananaazulmaçãverde– Gabriel Henrique
If you concatenate a ; the return does not solve, see how I put in the edited code.
– Gnomo Escalate