Re: [PHP] Re: Differences
On Thu, 2012-10-04 at 18:06 -0400, Jim Giner wrote: > 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. > > In this case, I"m looking for the function he called > "completeImageFilename" > > :):) > You might have missed mine: On Wed, 2012-10-03 at 21:58 -0500, tamouse mailing lists wrote: > (as a side note, the code you supplied would not work, as the name you > gave the function was "filename" yet the function you were trying to > call was "completeImageFileName".) > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Differences
On 10/4/2012 7:08 PM, David McGlone wrote: On Thursday, October 04, 2012 06:06:50 PM Jim Giner wrote: 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; } } 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. In this case, I"m looking for the function he called "completeImageFilename" :):) Uh Oh, we're in trouble ;-) Sorry about that Jim, I accidently typed the wrong function name. Here's the corrected code. Everybody's answer was spot on and I learned a great deal about return and echo. :-) function completeImageFilename($prefix) { $matches = glob('images/property_pics/'.$prefix.'*'); foreach($matches as $filename){ return $filename; } } echo completeImageFilename($row['MLS_No']); Hopefully you got my point tho - don't post code that is not THE ACTUAL CODE that you are running. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Differences
On Thursday, October 04, 2012 06:06:50 PM Jim Giner wrote: > 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; > > > > } > > > > } > > > > 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. > > In this case, I"m looking for the function he called > "completeImageFilename" > > :):) Uh Oh, we're in trouble ;-) Sorry about that Jim, I accidently typed the wrong function name. Here's the corrected code. Everybody's answer was spot on and I learned a great deal about return and echo. :-) function completeImageFilename($prefix) { $matches = glob('images/property_pics/'.$prefix.'*'); foreach($matches as $filename){ return $filename; } } echo completeImageFilename($row['MLS_No']); -- David M.
Re: [PHP] Re: differences in session handling between 4.1.1 and 4.3.1
I would also advise to check for register_globals, since I have the faint feeling it was OFF on your old version and ON in your new (though most logcial would be viceversa :P) register_globals are on in 4.1.1 and off in 4.3.1. So, your faint feeling was wrong (which I'm sorry for, cause any feeling that helps me, no matter how faint, are wanted. I'm going crazy here. ;-)) -- anders thoresson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php