View Single Post
Old 04-18-2009, 03:28 AM   #3 (permalink)
allworknoplay
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

Salathe/Tanax & company:

I currently have a method that needs to return 2 variables...maybe even 3, but let's say 2 for now. I'm currently doing it this way, do you know of any better way of doing it?

Tanax, this might look familiar to you....


Code:
function viewPage() {

//DO SOMETHING HERE AND RETURN DATA

$viewPageEntry[] = $this->starting_no;
$viewPageEntry[] = $this->end_count;
return $viewPageEntry;

}
In my HTML I am calling it and then assigning it to a variable,
then accessing each data this way.

Code:
$getViewPage = $pagination->viewPage();

echo $getViewPage[0];
echo $getViewPage[1];

I thought maybe OO was a bit more powerful or had a better way to access its data?

I thought maybe I would be able to access the data this way but it doesn't work.

Code:
echo $pagination->viewPage(starting_no);
echo $pagination->viewPage(end_count);
Maybe I should access it statically? Would that work?

Code:
$getViewPage::starting_no
$getViewPage::end_count
I get this error when I try the above code:

Quote:
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM
allworknoplay is offline  
Reply With Quote