PDA

View Full Version : Making functions


mouse
07-26-2002, 07:35 PM
Hi
this is probably really simple and something I've eitehr unwittingly done before or should know BUT... how do I create a function and how do I call it later?

:o feelin' stoopid already...

Spookster
07-26-2002, 07:50 PM
I'm too lazy to type today so here is a small tutorial with simple examples:

http://softwaredev.earthweb.com/servdev/article/0,,10528_956891_2,00.html


If you know how to do functions in javascript then you know how to do them in PHP. They are pretty much identical.


:D

Spookster
07-26-2002, 07:56 PM
And if you really want to be cool then you would want to get into creating PHP classes:

http://www.devshed.com/Server_Side/PHP/Class/page1.html

This works a lot like Java. You can create a class which could be full of functions/methods for doing specific kinds of tasks. Then you simply need to create an instance of that class and access the methods within it. Makes for more organized coding and modularity and stuff. :)