Note that there are some explanatory texts on larger screens.

plurals
  1. POConverting csv files data to an array using php str_getcsv function
    primarykey
    data
    text
    <p>I have string like which is created using <a href="http://php.net/manual/en/function.fputcsv.php" rel="nofollow noreferrer">fputcsv</a></p> <pre><code>Date,Name,Hours 2013-01-02,"Test User",7:59 2013-01-03,"Test User",7:53 2013-01-04,"Test User",8:12 2013-01-07,"Test User",7:56 2013-01-08,"Test User",8:25 2013-01-09,"Test User",7:56 2013-01-10,"Test User",8:10 2013-01-11,"Test User",7:53 2013-01-14,"Test User",7:54 2013-01-15,"Test User",0:34 2013-04-01,"Test User",5:51 2013-04-02,"Test User",8:50 2013-04-03,"Test User",7:25 2013-04-04,"Test User",8:3 2013-04-05,"Test User","10:42:52[Not punch out]" ,Total,103:1 </code></pre> <p>when proper header (header('Content-type: application/csv'); header('Content-Disposition: attachment; filename="'.$filename.'"');) is set it gives correct csv file.</p> <p><img src="https://i.stack.imgur.com/rc1cU.png" alt="Converting csv files data to an array using php str_getcsv "></p> <p>But I want this string again to be converted to a array format so I tried passing above string to <a href="http://php.net/manual/en/function.str-getcsv.php" rel="nofollow noreferrer">str_getcsv</a> but getting array like this</p> <pre><code>Array ( [0] =&gt; Date [1] =&gt; Name [2] =&gt; Hours 2013-01-02 [3] =&gt; "Allen Herrera" [4] =&gt; 7:59 2013-01-03 [5] =&gt; "Allen Herrera" [6] =&gt; 7:53 2013-01-04 [7] =&gt; "Allen Herrera" [8] =&gt; 8:12 2013-01-07 [9] =&gt; "Allen Herrera" [10] =&gt; 7:56 2013-01-08 [11] =&gt; "Allen Herrera" [12] =&gt; 8:25 2013-01-09 [13] =&gt; "Allen Herrera" [14] =&gt; 7:56 2013-01-10 [15] =&gt; "Allen Herrera" [16] =&gt; 8:10 2013-01-11 [17] =&gt; "Allen Herrera" [18] =&gt; 7:53 2013-01-14...................... </code></pre> <p>Can you help me to get properly formatted array so that I can easily use it to create table looping on the array.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload