示例#1
0
function convert($type_bablo, $new_val, $summa_babla)
{
    $bakstorub = 34.32;
    $eurotorub = 46.48;
    //echo "<br>type " . $type_bablo;
    //echo "<br>newType " . $new_val;
    if ($type_bablo != "рубли") {
        if ($type_bablo == "доллары") {
            if ($new_val == "рубли") {
                $summa_babla *= $bakstorub;
                return $summa_babla = rub_komis($summa_babla);
            }
            if ($new_val == "евро") {
                $summa_babla *= $bakstorub;
                $summa_babla = rub_komis($summa_babla);
                return $summa_babla /= $eurotorub;
            }
        }
        if ($type_bablo == "евро") {
            if ($new_val == "рубли") {
                //echo "<br>было евро " . $summa_babla;
                $summa_babla *= $eurotorub;
                //echo "<br>перевели в рубли " . $summa_babla;
                return rub_komis($summa_babla);
            }
            if ($new_val == "доллары") {
                $summa_babla *= $eurotorub;
                $summa_babla = rub_komis($summa_babla);
                return $summa_babla /= $bakstorub;
            }
        }
    } else {
        //echo "<br>было рублей " . $summa_babla;
        $summa_babla = rub_komis($summa_babla);
        //echo "<br>рублей " . $summa_babla;
        if ($new_val == "доллары") {
            return $summa_babla /= $bakstorub;
        }
        if ($new_val == "евро") {
            return $summa_babla /= $eurotorub;
        }
    }
}
示例#2
0
 /**
  * @dataProvider providerComm
  */
 public function testComm($analytical, $summ)
 {
     $this->assertEquals($analytical, rub_komis($summ));
 }