3v4l.org

run code in 300+ PHP versions simultaneously
<?php header("Content-Type: text/plain; charset=utf-8"); //b_internal_encoding('utf-8'); class Departament { public $Name; public $Count; public function CountEmployees($Employees) { //Число сотрудников в этом департаменте echo $Employees->Count; } /* public function CountSalaryCoffee() { //расходы на зарплату и на кофе по этому департаменту // } public function CountOfPage() { //Число страниц документов и отчетов, которые производит этот департамент // } public function AverageTugreeksPerPage() { //Посчитать средний расход тугриков на одну страницу // } public function SummSalaryCofePage() { //Расходы на зарплату и на кофе в сумме //Число страниц документов и отчетов, которые производят депортаменты в сумме } */ } class Employees extends Departament { public $position; public $cofe; public $page; public $rank; public $boss = false; public $baseSalary; public function CalculateTheSalary($Employees) //посчитать зарплату с учётом ранга { switch($Employees -> rank) { case 2: $Employees -> baseSalary+=($Employees -> baseSalary)*25/100; break; case 3: $Employees -> baseSalary+=($Employees -> baseSalary)*50/100;; break; } If ($countBoss == true) { $Employees -> baseSalary+=($Employees -> baseSalary)*50/100; } //return $Employees } public function HowMuchCoffeeIsDrinking($Employees) //Сколько кофе выпил сотрудник. Босс пьёт в два раза больше. { If ($countBoss == true) { $Employees -> cofe*=2; } } //Создаём сотрудника: профессия, ранг, босс(bool), кофе, страницы, оклад, название депортамента. public function CreateEmployees($position, $rank, $boss, $cofe, $page, $baseSalary, $nameDep) { $Employees = new Employees; $Employees -> position = $position; $Employees -> cofe = $cofe; $Employees -> page = $page; $Employees -> rank = $rank; $Employees -> boss = $boss; $Employees -> baseSalary = $baseSalary; $Employees -> Name = $nameDep; $Employees -> Count+=1; //return $Employees; } } //For ($i=1; $i=9; $i++) //{ CreateEmployees("Менеджер", 1, false, 20, 200, 500, "Закупки"); //9 сотрудников ме1 //} /* For ($i=1; $i=3; $i++) { CreateEmployees("Менеджер", 2, false, 20, 200, 500, "Закупки"); //3 сотрудника ме2 } For ($i=1; $i=2; $i++) { CreateEmployees("Менеджер", 3, false, 20, 200, 500, "Закупки"); //2 сотрудника ме3 $Employees -> Count+=1; } For ($i=1; $i=2; $i++) { CreateEmployees("Менеджер", 3, false, 20, 200, 500, "Закупки"); //2 сотрудника ма1 } CreateEmployees("Маркетолог", 1, true, 20, 200, 500, "Закупки"); //создаём босса ме2; */ //CountEmployees($Employees); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NoGYc
function name:  (null)
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'header'
          1        SEND_VAL                                                 'Content-Type%3A+text%2Fplain%3B+charset%3Dutf-8'
          2        DO_ICALL                                                 
   94     3        INIT_FCALL_BY_NAME                                       'CreateEmployees'
          4        SEND_VAL_EX                                              '%D0%9C%D0%B5%D0%BD%D0%B5%D0%B4%D0%B6%D0%B5%D1%80'
          5        SEND_VAL_EX                                              1
          6        SEND_VAL_EX                                              <false>
          7        SEND_VAL_EX                                              20
          8        SEND_VAL_EX                                              200
          9        SEND_VAL_EX                                              500
         10        SEND_VAL_EX                                              '%D0%97%D0%B0%D0%BA%D1%83%D0%BF%D0%BA%D0%B8'
         11        DO_FCALL                                      0          
  118    12      > RETURN                                                   1

Class Departament:
Function countemployees:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NoGYc
function name:  CountEmployees
number of ops:  4
compiled vars:  !0 = $Employees
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   13     1        FETCH_OBJ_R                                      ~1      !0, 'Count'
          2        ECHO                                                     ~1
   14     3      > RETURN                                                   null

End of function countemployees

End of class Departament.

Class Employees:
Function calculatethesalary:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 6, Position 2 = 13
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 27
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
filename:       /in/NoGYc
function name:  CalculateTheSalary
number of ops:  28
compiled vars:  !0 = $Employees, !1 = $countBoss
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   50     0  E >   RECV                                             !0      
   52     1        FETCH_OBJ_R                                      ~2      !0, 'rank'
   54     2        CASE                                                     ~2, 2
          3      > JMPNZ                                                    ~3, ->7
   57     4    >   CASE                                                     ~2, 3
          5      > JMPNZ                                                    ~3, ->13
          6    > > JMP                                                      ->19
   55     7    >   FETCH_OBJ_R                                      ~5      !0, 'baseSalary'
          8        MUL                                              ~6      ~5, 25
          9        DIV                                              ~7      ~6, 100
         10        ASSIGN_OBJ_OP                                 1          !0, 'baseSalary'
         11        OP_DATA                                                  ~7
   56    12      > JMP                                                      ->19
   58    13    >   FETCH_OBJ_R                                      ~9      !0, 'baseSalary'
         14        MUL                                              ~10     ~9, 50
         15        DIV                                              ~11     ~10, 100
         16        ASSIGN_OBJ_OP                                 1          !0, 'baseSalary'
         17        OP_DATA                                                  ~11
   59    18      > JMP                                                      ->19
         19    >   FREE                                                     ~2
   61    20        BOOL                                             ~12     !1
         21      > JMPZ                                                     ~12, ->27
   63    22    >   FETCH_OBJ_R                                      ~14     !0, 'baseSalary'
         23        MUL                                              ~15     ~14, 50
         24        DIV                                              ~16     ~15, 100
         25        ASSIGN_OBJ_OP                                 1          !0, 'baseSalary'
         26        OP_DATA                                                  ~16
   66    27    > > RETURN                                                   null

End of function calculatethesalary

Function howmuchcoffeeisdrinking:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/NoGYc
function name:  HowMuchCoffeeIsDrinking
number of ops:  6
compiled vars:  !0 = $Employees, !1 = $countBoss
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   67     0  E >   RECV                                             !0      
   69     1        BOOL                                             ~2      !1
          2      > JMPZ                                                     ~2, ->5
   71     3    >   ASSIGN_OBJ_OP                                 3          !0, 'cofe'
          4        OP_DATA                                                  2
   73     5    > > RETURN                                                   null

End of function howmuchcoffeeisdrinking

Function createemployees:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NoGYc
function name:  CreateEmployees
number of ops:  27
compiled vars:  !0 = $position, !1 = $rank, !2 = $boss, !3 = $cofe, !4 = $page, !5 = $baseSalary, !6 = $nameDep, !7 = $Employees
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   76     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV                                             !4      
          5        RECV                                             !5      
          6        RECV                                             !6      
   78     7        NEW                                              $8      'Employees'
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !7, $8
   79    10        ASSIGN_OBJ                                               !7, 'position'
         11        OP_DATA                                                  !0
   80    12        ASSIGN_OBJ                                               !7, 'cofe'
         13        OP_DATA                                                  !3
   81    14        ASSIGN_OBJ                                               !7, 'page'
         15        OP_DATA                                                  !4
   82    16        ASSIGN_OBJ                                               !7, 'rank'
         17        OP_DATA                                                  !1
   83    18        ASSIGN_OBJ                                               !7, 'boss'
         19        OP_DATA                                                  !2
   84    20        ASSIGN_OBJ                                               !7, 'baseSalary'
         21        OP_DATA                                                  !5
   85    22        ASSIGN_OBJ                                               !7, 'Name'
         23        OP_DATA                                                  !6
   86    24        ASSIGN_OBJ_OP                                 1          !7, 'Count'
         25        OP_DATA                                                  1
   88    26      > RETURN                                                   null

End of function createemployees

Function countemployees:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NoGYc
function name:  CountEmployees
number of ops:  4
compiled vars:  !0 = $Employees
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   13     1        FETCH_OBJ_R                                      ~1      !0, 'Count'
          2        ECHO                                                     ~1
   14     3      > RETURN                                                   null

End of function countemployees

End of class Employees.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.04 ms | 1404 KiB | 15 Q