Include and Require
Required Config
A setup file can load values that the main script expects before doing work.
Required Config
require_config.php
<?php
$subtotal = ;
include __DIR__ . "/price_config.inc";
$tax = $subtotal * $taxRate;
$total = $subtotal + $tax;
echo "subtotal=" . $subtotal . "\n";
echo "tax=" . $tax . "\n";
echo "total=" . $total . "\n";
<?php
$subtotal = ;
include __DIR__ . "/price_config.inc";
$tax = $subtotal * $taxRate;
$total = $subtotal + $tax;
echo "subtotal=" . $subtotal . "\n";
echo "tax=" . $tax . "\n";
echo "total=" . $total . "\n";
<?php
$subtotal = ;
include __DIR__ . "/price_config.inc";
$tax = $subtotal * $taxRate;
$total = $subtotal + $tax;
echo "subtotal=" . $subtotal . "\n";
echo "tax=" . $tax . "\n";
echo "total=" . $total . "\n";
required setup
Load required setup values before the main calculation that depends on them.