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. 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! 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); ?> 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! Link to comment https://forums.phpfreaks.com/topic/82149-solved-calling-a-function/#findComment-417464 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.