How to do a while with 2 checks

2

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);                                 
    }
?>
    
asked by anonymous 13.09.2017 / 23:34

1 answer

3

I think you do not want to make an assignment, but a right comparison? If it is supposed to contain "==" instead of "=", because if the assignment works it will always return true.

while($mediaA==0.5 and $mediaB==-0.5){
    
13.09.2017 / 23:54