title: parse csv in cell with new line using php
body: <p>I am trying to parse csv file using <code>fgetcsv</code> method in php.
  problem is that some cell having text which has new line character and because of that 
  it breaks all text after new line into other cell's value.
  how can i resolve this issue?</p>
  
  <p>my file having following data</p>
  
  <pre><code>label,value
  identifier_6,"label2323
  werffjdnfg
  sdfsdfdsfg
  dfgdfngdngd"
  </code></pre>
  
  <p>my code is</p>
  
  <pre><code>function parse_file($p_Filepath) {
  
          $file = fopen($p_Filepath, 'r');
          $this-&gt;fields = fgetcsv($file, $this-&gt;max_row_size, $this-&gt;separator, $this-&gt;enclosure);
          $keys_values = explode(',',$this-&gt;fields[0]);
  
          $content    =   array();
          $keys   =   $this-&gt;escape_string($keys_values);
  
          $i  =   0;
          while( ($row = fgetcsv($file, $this-&gt;max_row_size, $this-&gt;separator, $this-&gt;enclosure)) != false ) {            
              if( $row != null ) { // skip empty lines
                  $values =   explode(',',$row[0]);
  
                  if(count($keys) == count($values)){
                      $arr    =   array();
                      $new_values =   array();
                      $new_values =   $this-&gt;escape_string($values);
                      for($j=0;$j&lt;count($keys);$j++){
                          if($keys[$j] != ""){
                              $arr[$keys[$j]] =   $new_values[$j];
                          }
                      }
                      $content[$i]=   $arr;
                      $i++;
                  }
              }
          }
          fclose($file);
          $data['keys'] = $keys;
          $data['csvData'] = $content;
          return $data;
      }
  
      function escape_string($data){
          $result =   array();
  
          foreach($data as $row){
  //            $result[]   =   $row;
              $result[]   =   str_replace('"', '',$row);
          }
          return $result;
      }
  </code></pre>