Lamez Posted December 18, 2007 Share Posted December 18, 2007 I am new to functions to start off with! Alright how do I call a function from another page? for an example <?php //poop.php function displayAll(){ echo "poop"; } ?> in my new page new.php <?php include ("poop.php"); displayAll(); ?> is that syntax right? I am not sure on how to do this. Quote Link to comment https://forums.phpfreaks.com/topic/82149-solved-calling-a-function/ Share on other sites More sharing options...
Lamez Posted December 18, 2007 Author Share Posted December 18, 2007 tested, and worked, I was uploading the wrong page to the server, my bad! Quote Link to comment https://forums.phpfreaks.com/topic/82149-solved-calling-a-function/#findComment-417460 Share on other sites More sharing options...
Stooney Posted December 18, 2007 Share Posted December 18, 2007 Yep that's correct. Then if you want to pass variables to the functions: <?php //poop.php function displayAll($text){ echo $text; } ?> <?php //new.php $info="poop"; displayAll($info); ?> Quote Link to comment https://forums.phpfreaks.com/topic/82149-solved-calling-a-function/#findComment-417462 Share on other sites More sharing options...
Lamez Posted December 18, 2007 Author Share Posted December 18, 2007 oh thanks for the heads up! Quote Link to comment https://forums.phpfreaks.com/topic/82149-solved-calling-a-function/#findComment-417464 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.