klausimelis - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of klausimelis.php

  1. <?php
  2.  
  3. namespace Klausimelis;
  4.  
  5. class TuKaGejus implements Klausimas
  6. {
  7.     public $fieldType = Klausimas::YES_NO;
  8.     public $question = 'Ar Jūs esate homoseksualių pažiūrų?';
  9.     
  10.     public function whereTo($answer)
  11.     {
  12.         if ($answer === Klausimas::ANSWER_YES) {
  13.             return PasyvusArAktyvus::class;
  14.         }
  15.         
  16.         return PapaiArSiknos::class;
  17.     }
  18. }
  19.  
  20. interface Klausimas
  21. {
  22.     public const YES_NO = 'yes_no';
  23.     public const ANSWER_YES = 'yes';
  24.     
  25.     public $fieldType;
  26.     public $question;
  27.     public function whereTo($answer);
  28. }
File Description
  • klausimelis
  • PHP Code
  • 10 Jan-2020
  • 570 Bytes
You can Share it: