I'm trying to get the while values to stop but it just does not go into while, I'm starting programming so try to help in a simple way
Purpose of code: Get 0 of a 1 degree function dynamically ...
<?php
print("Qual é o expoente de sua função?\n");
$menu = fgets(STDIN);
if ($menu == 1) {
print("Coloque o valor de A:");
$a = fgets(STDIN);
print("Coloque o valor de B:");
$b = fgets(STDIN);
$xa = 106000;
$xb =-102000;
while($mediaA=0.5 and $mediaB=-0.5){
$resultA = $a*$xa+$b;
$resultB = $a*$xb+$b;
$mediaA = $resultA/2;
$mediaB = $resultB/2;
$resultmedia = $a*$media+$b;
if($mediaA > 0 and $mediaB > 0){
$xb = $resultB;
$xa = $mediaB;
}elseif($resultB<0){
$xa = $mediaA;
$xb = $mediaB;
}elseif($mediaA < 0 and $mediaB < 0) {
$xb = $mediaB;
$xa = $resultA;
}elseif($mediaB>0) {
$xa = $mediaB;
$xb = $mediaA;
}
}
print($mediaA.$mediaB);
}
?>