
L = Length of cardboard sheet
W = Width of cardboard sheet

d = Depth of created box

Given the length (L) and width (W) of a piece of cardboard, we cut squares
with edges of length (d) out of each corner of the rectangle. The value of
(d) will be the depth of the box.

Next, we fold up the edges of what remains to form a box of volume (V).

The length of the box = (L - 2*d)
The width of the box  = (W - 2*d)
The depth of the box  = d



// ****************************************
// OK

$w = Max_Box_Vol_Stats (50, 70);

print
"<pre>
$w
</pre>";

   function Max_Box_Vol_Stats ($Length, $Width)
{
   $L = trim($Length);
   $W = trim($Width);

   $d = ($L + $W - SqRt(($L+$W)*($L+$W) - 3*$L*$W)) / 6;

   $Vmax = ($L-2*$d)*($W-2*$d)*$d;

   $A = ($L-2*$d)*($W-2*$d);

   return
"Length  = $L
Width   = $W
Depth   = $d
Area    = $A
Volume  = $Vmax";
}







