implode multidim array [solved]
Posted: Wed Jan 16, 2008 11:11 pm
hello, I am tryin to do something that I'm sure any experienced php programmer (which I am not) can do without thought.
I have a multidim array, two dimensions, the first is the name, price, qty, and total of an item,
It is nested into another array , we'll call it $line_item. now each product has it's own line when I print it out to the screen if I print the arrays to the screen.
But I don't want to print them to the screen, I want to be able to use all the values in a function called fpdf which takes a string or a variable representing a string as the parameter for creating a pdf (my reciept).
so here is what I have came up with so far:
The result of this is that I get only the first line item displayed in my pdf.
I am a beginner and I am putting alot of effort in before just posting and saying how do you do this, I have been reading the manual extensively.
This could be completely the wrong approach to getting these values from this array, and if it is please feel free to do it any other way that you feel is better, all sugestions are greatly appreciated.
I have a multidim array, two dimensions, the first is the name, price, qty, and total of an item,
It is nested into another array , we'll call it $line_item. now each product has it's own line when I print it out to the screen if I print the arrays to the screen.
But I don't want to print them to the screen, I want to be able to use all the values in a function called fpdf which takes a string or a variable representing a string as the parameter for creating a pdf (my reciept).
so here is what I have came up with so far:
Code: Select all
function breakdown() {
foreach ($_SESSION['sale_info'] as $si) {
return (implode("\t",$si) ); } ;}
I am a beginner and I am putting alot of effort in before just posting and saying how do you do this, I have been reading the manual extensively.
This could be completely the wrong approach to getting these values from this array, and if it is please feel free to do it any other way that you feel is better, all sugestions are greatly appreciated.