Re: Function not returning



Mike schreef:
Thanks, that all works now.

Can you explain though why it wasn't returning $reply?


It was, but you didn't store the output. When a function returns something, it's not magically stored into a global variable.

For this you can use a reference, the global keyword or the $GLOBALS array.

Perhaps you should examin the section that describes functions in the online manual more closely (especially regarding returns from functions):

http://www.php.net/manual/hk/functions.php


JW
.



Relevant Pages

  • RE: Storing data in an add-in for use later
    ... module to store global variables. ... the name and password in the globals. ... When the user tries to interact with the database the first ... I have an add-in which multiple users use. ...
    (microsoft.public.excel.programming)
  • Re: What is common practice?
    ... It is a question of style, Jim, but I don't like globals because: ... They lose their value when you reset your code, ... I also prefer to store these configuration settings/values as records instead of fields in this table. ... If you have a 1-record table which contains various settings for an application, and those settings are used frequently in different functions of the app, say via a function which opens the tbl_Settings recordset and returns the appropriate field, is it more common to run the function every time a setting is needed, or to use a global variable, and use the function only once at startup to assign the variable value. ...
    (microsoft.public.access.formscoding)
  • globals (again?)
    ... Is there any way I can store all my globals in one file while making them accessible to other modules? ... I know I can do an extern on each one in the relevent module, but it rather defeats the whole purpose. ... http://www.onetribe.me.uk/wordpress/?cat=5 - Our podcasts on weird stuff ...
    (comp.lang.c)
  • Re: Improving efficiency of a bytecode interpreter
    ... Well, you just use globals, although that is frowned upon in this ... But if the compiler has just computed `pc++' ... it must first spill the register back to the global ... Both the store and the fetch (and any ...
    (comp.lang.c)