Function returns CSV File: How to go about checking it ?

Posted by Rachel on Stack Overflow See other posts from Stack Overflow or by Rachel
Published on 2010-03-29T17:34:44Z Indexed on 2010/03/29 17:43 UTC
Read the original article Hit count: 389

Filed under:
|

I am doing something like:

$outputFile = getCurrentDBSnapshot($data);

where $data is the resource stream that am passing in, basically from command prompt am passing an file and am opening it using fopen for writing with 'w+' permissions, now getCurrentDBSnapshot would get the current state of a table and would update the $data csv file, so basically $outputFile would be updated with the current state of database table, now I want to var_dump or print the value of $outputFile to see the data present into it.

But when I do

$this->fout = fopen($outputFile,'r') or die('Cannot open file');
$test = fgetcsv($outputFile,5000,":");
var_dump($test);

It gives me an error saying that it expects parameter 1 to be a string type and am passing resource.

My goal to see the contains of $outputFile

and so my question is that

How can I see the contains present in $outputFile or how can I see what getcurrentDBSnapshot function is returning me ?

© Stack Overflow or respective owner

Related posts about php

Related posts about csv