I need to write a block of code and use it over and over in my script with a simple declaration. Kind of like functions in Javascript. Somthing like
function fizzlePants {
echo "blah"
}
if(blah) {
return fizzlePants
}
I know that wont work at all but its the concept im after. Can anyone help?
question about functions
Moderator: General Moderators
-
chris12295
- Forum Contributor
- Posts: 113
- Joined: Sun Jun 09, 2002 10:28 pm
- Location: USA
- Contact:
- hob_goblin
- Forum Regular
- Posts: 978
- Joined: Sun Apr 28, 2002 9:53 pm
- Contact:
Code: Select all
function fizzlePants(){
echo "blah blah blah";
}
fizzlePants();will print "blah blah blah"
Code: Select all
function fizzlePants(){
echo "blah blah blah";
}
if($blah){
fizzlePants();
}Code: Select all
$blah = "ack";
function fizzlePants($foo){
echo "blah blah blah $blah $blah $blah";
}
if($blah){
fizzlePants($blah);
}i would still reccomend you read a tutorial on functions though... there is alot to say about them