Using include() to Execute PHP and Assign the Return Value : Include « Language Basics « PHP






Using include() to Execute PHP and Assign the Return Value





<html>
<head>
<title>Using include() to execute PHP and assign the return value</title>
</head>
<body>
<?php
    $addResult = include("myIncludeFileWithReturnValue.php");
    print "The include file returned $addResult";
?>
</body>
</html>

<!-- myIncludeFileWithReturnValue.php
<?php
$retval = ( 4 + 4 );
return $retval;
?>
-->

           
       








Related examples in the same category

1.Test of PHP Includes
2.Using include() Within a Loop
3.Using include()