Exemplo n.º 1
0
 public static function ex1()
 {
     self::$u = 1;
     $lowest = $u;
     $step = 0;
     while (1 + $u !== 1.0) {
         $u = (double) $u / 10;
         $step++;
         $lowest = $u;
     }
     header('Content-type: application/json');
     // make json
     echo json_encode(array('step' => $step, 'lowest' => $lowest, 'u' => $u));
     exit;
 }
Exemplo n.º 2
0
if (isset($_POST['action'])) {
    if (isset($_POST['homework'])) {
        switch ($_POST['homework']) {
            case 1:
                switch ($_POST['action']) {
                    case 'ex1':
                        HomeWork1::ex1();
                        break;
                    case 'ex2':
                        HomeWork1::ex2();
                        break;
                    case 'ex3':
                        HomeWork1::ex3();
                        break;
                    case 'ex4':
                        HomeWork1::ex4();
                        break;
                }
                break;
            case 2:
                switch ($_POST['action']) {
                    case 'ex1':
                        HomeWork2::ex1();
                        break;
                    case 'ex2':
                        HomeWork2::ex2();
                        break;
                    case 'ex3':
                        HomeWork2::ex3();
                        break;
                    case 'ex4':