Re: Differences
| From: | Jim Giner | Date: | Thu, 04 Oct 2012 22:06:50 +0000 |
| Subject: | Re: Differences | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-319363@lists.php.net to get a copy of this message | ||
On 10/3/2012 8:48 PM, David McGlone wrote:
Hi everyone, I have been playing around with some code the list helped me with a while back and I'm not grasping the concept between return and echo and the PHP manual doesn't answer this, unless I'm missing something. There is an example at the very bottom of PHP's return manual, but it's confusing. So now I'm left wondering why return will only give me the first result in an array, but echo will give me all the results of the array. Using stuart's example he had sent me a while back I've messed around with it and modified it to better understand it: function filename($prefix) { $matches = glob('images/property_pics/'.$prefix.'*'); foreach($matches as $filename){ return $filename;In this case, I"m looking for the function he called "completeImageFilename" :):)}} echo completeImageFilename($row['MLS_No']); With the above code I only get the first image of each picture name, but when I change return to echo, it groups and displays all the pics that have the same picture name. -- David M. I've read thru 9 responses to the OP and not one of you mentioned that the code presented is problematic in itself. Very forgiving, but perhaps someone should have suggested that he post "actual code" when looking for help in the future, and not some typing that is supposed to represent the problem.