Jump to content

[SOLVED] call function from one script to another php script


lordrt

Recommended Posts

Use the include function. 

 

 

e.g.

 

script1.php

<?php
function addNumbers($x,$y){
return $x + $y;
}
?>

 

script2.php

<?php
include("script1.php");

$num1 = 5;
$num2 = 3;

$total = addNumbers($num1,$num2);

print $num1 . " + " . $num2 . " = " . $total;
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.