returning values from function or method multiple times by only calling the class once

Posted by Sokhrat Sikar on Stack Overflow See other posts from Stack Overflow or by Sokhrat Sikar
Published on 2012-03-22T23:16:40Z Indexed on 2012/03/22 23:29 UTC
Read the original article Hit count: 154

Filed under:
|
|
|
|

I have a members.php file that shows my websites members. I echo members name by using foreach method. A method of Members class returns an array, then I use foreach loop in the members.php file to echo the members. I am trying to aovid writing php code in my members.php file. Is there a way to avoid using foreach inside members.php file?

For example, is it possible to return value from a method couple of times? (by only calling the object once). Just like how we normally call the functions? This question doesn't make sense, but I am just trying to see if there is a away around this issue?

© Stack Overflow or respective owner

Related posts about php

Related posts about arrays