question asker
New member
The other page must be included (or required) before it's functions are called. The variables must also be declared global in both functions.. e.g.
// page1.php
<?php
require_once("page2.php");
firstFunction();
function firstFunction() {
global $x, $y;
secondFunction();
echo $x . ", " . $y;
}
?>
// page2.php
<?php
function secondFunction() {
global $x, $y;
$x = 5;
$y = 10;
}
?>
Good luck!
// page1.php
<?php
require_once("page2.php");
firstFunction();
function firstFunction() {
global $x, $y;
secondFunction();
echo $x . ", " . $y;
}
?>
// page2.php
<?php
function secondFunction() {
global $x, $y;
$x = 5;
$y = 10;
}
?>
Good luck!