PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
You are not a newbie and didn't know that? Good lord, if you have been writing a ton of code without using function returns then you are one hard core dude.
Perhaps a book like Learing PHP from O'Reilly press would be a good idea. Just spend 15 minutes a day with it on the toilet and you will learn a lot of stuff that will make your coding life a lot easier.
Last edited by Begby on Fri Mar 30, 2007 8:23 am, edited 1 time in total.
You are not a newbie and didn't know that? Good lord, if you have been writing a ton of code without using function returns then you are one hard core dude.
Perhaps a book like Learing PHP from O'Reilly press would be a good idea. Just spend 15 minutes a day with it on the toilet and you will learn a lot of stuff that will make your coding life a lot easier.
Lol thanks yeh I have mainly been using c&p for all of the functions. I have written quite a few website with out it. Is it possible to use
You can only return one thing at a time. As soon as you hit the first return the function is immediately exited with no other code in that function executed.
To return multiple items you will either need to return an array, return an object, or pass parameters to the function by reference and change their values.
Edit: Haha, I type quicker than Feyd
|
|
V
Last edited by Begby on Fri Mar 30, 2007 8:45 am, edited 1 time in total.
Neither are usable. To return multiple values you use an array. Functions can only return one thing. That one thing may contain other things, but the function itself can only return one thing.