lordrt Posted August 4, 2009 Share Posted August 4, 2009 Hello all Am trying to call a function found in one php script to another php script, can anyone plz help with the code for this Link to comment https://forums.phpfreaks.com/topic/168758-solved-call-function-from-one-script-to-another-php-script/ Share on other sites More sharing options...
phpSensei Posted August 4, 2009 Share Posted August 4, 2009 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; ?> Link to comment https://forums.phpfreaks.com/topic/168758-solved-call-function-from-one-script-to-another-php-script/#findComment-890357 Share on other sites More sharing options...
lordrt Posted August 4, 2009 Author Share Posted August 4, 2009 thx Link to comment https://forums.phpfreaks.com/topic/168758-solved-call-function-from-one-script-to-another-php-script/#findComment-890371 Share on other sites More sharing options...
phpSensei Posted August 4, 2009 Share Posted August 4, 2009 thanks np. and please click the Mark As Solved Button beside the Reply, Mark Unread..etc buttons Link to comment https://forums.phpfreaks.com/topic/168758-solved-call-function-from-one-script-to-another-php-script/#findComment-890376 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.