fork download
  1. <?php
  2.  
  3. include('classes.php');
  4.  
  5. $input = [
  6. [43, Employee::MANAGER, 1],
  7. [9, Employee::MANAGER, 2],
  8. [2, Employee::MANAGER, 3],
  9. [23, Employee::MARKETER, 1],
  10. [11, Employee::MARKETER, 2],
  11. [1, Employee::MARKETER, 3],
  12. [3, Employee::ANALYST, 1],
  13. [2, Employee::ANALYST, 2],
  14. [7, Employee::ENGINEER, 1]
  15. ];
  16.  
  17. $employeeObjects = [];
  18.  
  19. foreach ($input as $employeeGroup) {
  20. $quantity = $employeeGroup[0];
  21. $type = $employeeGroup[1];
  22. $grade = $employeeGroup[2];
  23. for ($c = 0; $c < $quantity; $c++) {
  24. $employeeObjects[] = new $type($grade);
  25. }
  26. }
Runtime error #stdin #stdout #stderr 0.04s 24036KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Warning:  include(classes.php): failed to open stream: No such file or directory in /home/HY2nDL/prog.php on line 3
PHP Warning:  include(): Failed opening 'classes.php' for inclusion (include_path='.:/usr/share/php') in /home/HY2nDL/prog.php on line 3
PHP Fatal error:  Uncaught Error: Class 'Employee' not found in /home/HY2nDL/prog.php:6
Stack trace:
#0 {main}
  thrown in /home/HY2nDL/prog.php on line 6