vraag 4 - 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 vraag 4.php

  1. <?php
  2. function calc1 ($inkomen) {
  3.   if($inkomen <= 25000)
  4.     $belasting = $inkomen * 0.33;
  5.   else if ($inkomen <= 50000)
  6.     $belasting = 1000 + ($inkomen - 10000) * 0.45;
  7.   return $belasting;
  8. }
  9.  
  10. function calc2 ($inkomen) {
  11.   if($inkomen <= 25000)
  12.     $belasting = $inkomen * 0.33;
  13.   else if($inkomen > 25000 && $inkomen <= 50000)
  14.     $belasting = 1000 + ($inkomen - 10000) * 0.45;
  15.   return $belasting;
  16. }
  17.  
  18. echo "start\r\n";
  19. for ($i=0; $i<55000; $i++) {
  20.   echo calc1($i)!==calc2($i) ? "Berekening komt niet overeen voor het cijfer ".$i."\r\n" : '';
  21. }
  22. echo "end\r\n";
File Description
  • vraag 4
  • PHP Code
  • 04 Feb-2020
  • 589 Bytes
You can Share it: