Hi all -
I'm a relative newbie to PHP, and I've looked around a bit, but haven't found information that relates directly to what I'm working on. I have found bits and pieces, and I'm having trouble putting it all together to come to a solution.
I have a string that represents report data that is being returned from Curl interaction with stored procedures on MS SQLServer (please don't ask -- it's a long story, and this is the only way that the corporate data gatekeepers will let us interact with the D😎. The "rows" of data for the report are CRLF-delimited, and the "columns" are tab-delimited. I've managed to populate a multi-dimensional array with the data using
$arrayRow = explode("\n", $page_out); \$page_out is the string from curl
foreach($arrayRow as $r => $row) {
$arrayCol = explode("\t", $row);
foreach($arrayCol as $c => $col){
$arrayData[$r][$c] = $col;
}
}
and I need to put the array data into variables that can be used for output in the HTML for the report. How can I do that? I've had some luck with this using this instead of the above code:
$arrayRow = explode("\n", $page_out);
foreach($arrayRow as $r => $row) {
$arrayCol = explode("\t", $row);
list(my vars) = $arrayCol;
echo my vars;
}
The bigger question is which is the best way to tackle this problem. Is there a more elegant solution, or possibly even a built-in solution like fgetcsv()? Does someone have some code for something similar that
they'd be willing to share?
Thanks for any help you can give me,
Phil