- var_dump: documentation ( source)
- abs: documentation ( source)
- ceil: documentation ( source)
- range: documentation ( source)
<?php
$a = 1110;
$b = 370;
$c = 6171.6;
$h = 71.1;
$i = -50; // undef
$k = 0; // undef
$l = 0; // undef
$step = 0.001; // Auflösung für $i
$i_max = 100; // um keine Endlosschleife zu produzieren
$epsilon = 0.001; // Fehlertoleranz
$found = false;
do {
$k = 0.9942;
$l = 0.998670248976177;
$tmp = (556 / ($h / (545.223880597015 / 1000 * $k * $l)));
$found = (abs($i - $tmp) <= $epsilon);
if (!$found) {
$i += $step;
}
if ($i > $i_max) {
throw new Exception('Unable to calculate $i');
}
} while (!$found);
$g = ceil($h / (545.223880597015 / 1000 * $l * $k));
//$i = 556 / $g; // ??? $i haben wir schon
$j = $g * $b / 1000 * $a / 100 * 1;
$e = ($i - $b / 1000) * $a / 100;
$f = $i * $a / 100;
$d = $c - $j;
foreach (range('a', 'l') as $var) {
echo $var . ' = ';
var_dump($$var);
echo '<br />';
}
?>