3v4l.org

run code in 300+ PHP versions simultaneously
<?php header('Content-Type: application/json'); error_reporting(E_ALL); ini_set('display_errors', 1); class Mushroom { public $microdose = 0.25; public $regular = 2.5; public $heroic = 5.0; public $wetRatio = 9.3; public $wet = null; public $maoRatio = 2; public $mao = null; public $dosageFactor = null; public $strains = [ "azurenscens" => "1.78", "bohemica" => "1.34", "semilanceata" => ".98", "baeocystis" => ".85", "cyanescens" => ".85", "tampanensis" => ".68", "cubensis" => ".63", "weilii" => ".61", "hoogshagenii" => ".60", "stuntzii" => ".36", "cyanofibrillosa" => ".21", "liniformans" => ".16", "penis envy" => "1.35" ]; public function __construct() { ksort($this->strains, SORT_NATURAL | SORT_STRING); $this->wet = $_GET['wet'] ?? 0; $this->mao = $_GET['mao'] ?? 0; if ($this->wet && $this->mao) { $this->microdose = (($this->microdose * $this->wetRatio) / $this->maoRatio); $this->regular = (($this->regular * $this->wetRatio) / $this->maoRatio); $this->heroic = (($this->heroic * $this->wetRatio) / $this->maoRatio); } else if ($this->wet) { $this->microdose = $this->microdose * $this->wetRatio; $this->regular = $this->regular * $this->wetRatio; $this->heroic = $this->heroic * $this->wetRatio; } else if ($this->mao) { $this->microdose = $this->microdose / $this->maoRatio; $this->regular = $this->regular / $this->maoRatio; $this->heroic = $this->heroic / $this->maoRatio; } } public function getAll() { $dose = []; foreach ($this->strains as $strain => $potency) { $this->dosageFactor = $potency / $this->strains['cubensis']; $dose[$strain]['name'] = "Psilocybin " . ucfirst($strain); $dose[$strain]['microdose'] = round(($this->microdose / $this->dosageFactor), 2); $dose[$strain]['regular'] = round(($this->regular / $this->dosageFactor), 2); $dose[$strain]['heroic'] = round(($this->heroic / $this->dosageFactor), 2); } return $dose; } public function getMicrodose() { $dose = []; foreach ($this->strains as $strain => $potency) { $this->dosageFactor = $potency / $this->strains['cubensis']; $dose[$strain]['name'] = "Psilocybin " . ucfirst($strain); $dose[$strain]['microdose'] = round(($this->microdose / $this->dosageFactor), 2); } return $dose; } public function getRegular() { $dose = []; foreach ($this->strains as $strain => $potency) { $this->dosageFactor = $potency / $this->strains['cubensis']; $dose[$strain]['name'] = "Psilocybin " . ucfirst($strain); $dose[$strain]['regular'] = round(($this->microdose / $this->dosageFactor), 2); } return $dose; } public function getHeroic() { $dose = []; foreach ($this->strains as $strain => $potency) { $this->dosageFactor = $potency / $this->strains['cubensis']; $dose[$strain]['name'] = "Psilocybin " . ucfirst($strain); $dose[$strain]['heroic'] = round(($this->microdose / $this->dosageFactor), 2); } return $dose; } } $mushroom = new Mushroom(); echo json_encode($mushroom->getAll());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hPFiP
function name:  (null)
number of ops:  20
compiled vars:  !0 = $mushroom
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'header'
          1        SEND_VAL                                                 'Content-Type%3A+application%2Fjson'
          2        DO_ICALL                                                 
    4     3        INIT_FCALL                                               'error_reporting'
          4        SEND_VAL                                                 32767
          5        DO_ICALL                                                 
    5     6        INIT_FCALL                                               'ini_set'
          7        SEND_VAL                                                 'display_errors'
          8        SEND_VAL                                                 1
          9        DO_ICALL                                                 
  100    10        NEW                                              $4      'Mushroom'
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !0, $4
  101    13        INIT_FCALL                                               'json_encode'
         14        INIT_METHOD_CALL                                         !0, 'getAll'
         15        DO_FCALL                                      0  $7      
         16        SEND_VAR                                                 $7
         17        DO_ICALL                                         $8      
         18        ECHO                                                     $8
         19      > RETURN                                                   1

Class Mushroom:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 44
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 79
Branch analysis from position: 79
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 44
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 62
Branch analysis from position: 46
1 jumps found. (Code = 42) Position 1 = 79
Branch analysis from position: 79
Branch analysis from position: 62
2 jumps found. (Code = 43) Position 1 = 64, Position 2 = 79
Branch analysis from position: 64
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 79
Branch analysis from position: 21
filename:       /in/hPFiP
function name:  __construct
number of ops:  80
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   INIT_FCALL                                               'ksort'
          1        FETCH_OBJ_W                                      $0      'strains'
          2        SEND_REF                                                 $0
          3        SEND_VAL                                                 6
          4        DO_ICALL                                                 
   36     5        FETCH_IS                                         ~3      '_GET'
          6        FETCH_DIM_IS                                     ~4      ~3, 'wet'
          7        COALESCE                                         ~5      ~4
          8        QM_ASSIGN                                        ~5      0
          9        ASSIGN_OBJ                                               'wet'
         10        OP_DATA                                                  ~5
   37    11        FETCH_IS                                         ~7      '_GET'
         12        FETCH_DIM_IS                                     ~8      ~7, 'mao'
         13        COALESCE                                         ~9      ~8
         14        QM_ASSIGN                                        ~9      0
         15        ASSIGN_OBJ                                               'mao'
         16        OP_DATA                                                  ~9
   39    17        FETCH_OBJ_R                                      ~10     'wet'
         18      > JMPZ_EX                                          ~10     ~10, ->21
         19    >   FETCH_OBJ_R                                      ~11     'mao'
         20        BOOL                                             ~10     ~11
         21    > > JMPZ                                                     ~10, ->44
   40    22    >   FETCH_OBJ_R                                      ~13     'microdose'
         23        FETCH_OBJ_R                                      ~14     'wetRatio'
         24        MUL                                              ~15     ~13, ~14
         25        FETCH_OBJ_R                                      ~16     'maoRatio'
         26        DIV                                              ~17     ~15, ~16
         27        ASSIGN_OBJ                                               'microdose'
         28        OP_DATA                                                  ~17
   41    29        FETCH_OBJ_R                                      ~19     'regular'
         30        FETCH_OBJ_R                                      ~20     'wetRatio'
         31        MUL                                              ~21     ~19, ~20
         32        FETCH_OBJ_R                                      ~22     'maoRatio'
         33        DIV                                              ~23     ~21, ~22
         34        ASSIGN_OBJ                                               'regular'
         35        OP_DATA                                                  ~23
   42    36        FETCH_OBJ_R                                      ~25     'heroic'
         37        FETCH_OBJ_R                                      ~26     'wetRatio'
         38        MUL                                              ~27     ~25, ~26
         39        FETCH_OBJ_R                                      ~28     'maoRatio'
         40        DIV                                              ~29     ~27, ~28
         41        ASSIGN_OBJ                                               'heroic'
         42        OP_DATA                                                  ~29
         43      > JMP                                                      ->79
   44    44    >   FETCH_OBJ_R                                      ~30     'wet'
         45      > JMPZ                                                     ~30, ->62
   45    46    >   FETCH_OBJ_R                                      ~32     'microdose'
         47        FETCH_OBJ_R                                      ~33     'wetRatio'
         48        MUL                                              ~34     ~32, ~33
         49        ASSIGN_OBJ                                               'microdose'
         50        OP_DATA                                                  ~34
   46    51        FETCH_OBJ_R                                      ~36     'regular'
         52        FETCH_OBJ_R                                      ~37     'wetRatio'
         53        MUL                                              ~38     ~36, ~37
         54        ASSIGN_OBJ                                               'regular'
         55        OP_DATA                                                  ~38
   47    56        FETCH_OBJ_R                                      ~40     'heroic'
         57        FETCH_OBJ_R                                      ~41     'wetRatio'
         58        MUL                                              ~42     ~40, ~41
         59        ASSIGN_OBJ                                               'heroic'
         60        OP_DATA                                                  ~42
         61      > JMP                                                      ->79
   49    62    >   FETCH_OBJ_R                                      ~43     'mao'
         63      > JMPZ                                                     ~43, ->79
   50    64    >   FETCH_OBJ_R                                      ~45     'microdose'
         65        FETCH_OBJ_R                                      ~46     'maoRatio'
         66        DIV                                              ~47     ~45, ~46
         67        ASSIGN_OBJ                                               'microdose'
         68        OP_DATA                                                  ~47
   51    69        FETCH_OBJ_R                                      ~49     'regular'
         70        FETCH_OBJ_R                                      ~50     'maoRatio'
         71        DIV                                              ~51     ~49, ~50
         72        ASSIGN_OBJ                                               'regular'
         73        OP_DATA                                                  ~51
   52    74        FETCH_OBJ_R                                      ~53     'heroic'
         75        FETCH_OBJ_R                                      ~54     'maoRatio'
         76        DIV                                              ~55     ~53, ~54
         77        ASSIGN_OBJ                                               'heroic'
         78        OP_DATA                                                  ~55
   54    79    > > RETURN                                                   null

End of function __construct

Function getall:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 48
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 48
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 48
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 48
filename:       /in/hPFiP
function name:  getAll
number of ops:  51
compiled vars:  !0 = $dose, !1 = $potency, !2 = $strain
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   57     0  E >   ASSIGN                                                   !0, <array>
   58     1        FETCH_OBJ_R                                      ~4      'strains'
          2      > FE_RESET_R                                       $5      ~4, ->48
          3    > > FE_FETCH_R                                       ~6      $5, !1, ->48
          4    >   ASSIGN                                                   !2, ~6
   59     5        FETCH_OBJ_R                                      ~9      'strains'
          6        FETCH_DIM_R                                      ~10     ~9, 'cubensis'
          7        DIV                                              ~11     !1, ~10
          8        ASSIGN_OBJ                                               'dosageFactor'
          9        OP_DATA                                                  ~11
   60    10        INIT_FCALL                                               'ucfirst'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                         $14     
         13        CONCAT                                           ~15     'Psilocybin+', $14
         14        FETCH_DIM_W                                      $12     !0, !2
         15        ASSIGN_DIM                                               $12, 'name'
         16        OP_DATA                                                  ~15
   61    17        INIT_FCALL                                               'round'
         18        FETCH_OBJ_R                                      ~18     'microdose'
         19        FETCH_OBJ_R                                      ~19     'dosageFactor'
         20        DIV                                              ~20     ~18, ~19
         21        SEND_VAL                                                 ~20
         22        SEND_VAL                                                 2
         23        DO_ICALL                                         $21     
         24        FETCH_DIM_W                                      $16     !0, !2
         25        ASSIGN_DIM                                               $16, 'microdose'
         26        OP_DATA                                                  $21
   62    27        INIT_FCALL                                               'round'
         28        FETCH_OBJ_R                                      ~24     'regular'
         29        FETCH_OBJ_R                                      ~25     'dosageFactor'
         30        DIV                                              ~26     ~24, ~25
         31        SEND_VAL                                                 ~26
         32        SEND_VAL                                                 2
         33        DO_ICALL                                         $27     
         34        FETCH_DIM_W                                      $22     !0, !2
         35        ASSIGN_DIM                                               $22, 'regular'
         36        OP_DATA                                                  $27
   63    37        INIT_FCALL                                               'round'
         38        FETCH_OBJ_R                                      ~30     'heroic'
         39        FETCH_OBJ_R                                      ~31     'dosageFactor'
         40        DIV                                              ~32     ~30, ~31
         41        SEND_VAL                                                 ~32
         42        SEND_VAL                                                 2
         43        DO_ICALL                                         $33     
         44        FETCH_DIM_W                                      $28     !0, !2
         45        ASSIGN_DIM                                               $28, 'heroic'
         46        OP_DATA                                                  $33
   58    47      > JMP                                                      ->3
         48    >   FE_FREE                                                  $5
   65    49      > RETURN                                                   !0
   66    50*     > RETURN                                                   null

End of function getall

Function getmicrodose:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 28
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 28
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
filename:       /in/hPFiP
function name:  getMicrodose
number of ops:  31
compiled vars:  !0 = $dose, !1 = $potency, !2 = $strain
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   69     0  E >   ASSIGN                                                   !0, <array>
   70     1        FETCH_OBJ_R                                      ~4      'strains'
          2      > FE_RESET_R                                       $5      ~4, ->28
          3    > > FE_FETCH_R                                       ~6      $5, !1, ->28
          4    >   ASSIGN                                                   !2, ~6
   71     5        FETCH_OBJ_R                                      ~9      'strains'
          6        FETCH_DIM_R                                      ~10     ~9, 'cubensis'
          7        DIV                                              ~11     !1, ~10
          8        ASSIGN_OBJ                                               'dosageFactor'
          9        OP_DATA                                                  ~11
   72    10        INIT_FCALL                                               'ucfirst'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                         $14     
         13        CONCAT                                           ~15     'Psilocybin+', $14
         14        FETCH_DIM_W                                      $12     !0, !2
         15        ASSIGN_DIM                                               $12, 'name'
         16        OP_DATA                                                  ~15
   73    17        INIT_FCALL                                               'round'
         18        FETCH_OBJ_R                                      ~18     'microdose'
         19        FETCH_OBJ_R                                      ~19     'dosageFactor'
         20        DIV                                              ~20     ~18, ~19
         21        SEND_VAL                                                 ~20
         22        SEND_VAL                                                 2
         23        DO_ICALL                                         $21     
         24        FETCH_DIM_W                                      $16     !0, !2
         25        ASSIGN_DIM                                               $16, 'microdose'
         26        OP_DATA                                                  $21
   70    27      > JMP                                                      ->3
         28    >   FE_FREE                                                  $5
   75    29      > RETURN                                                   !0
   76    30*     > RETURN                                                   null

End of function getmicrodose

Function getregular:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 28
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 28
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
filename:       /in/hPFiP
function name:  getRegular
number of ops:  31
compiled vars:  !0 = $dose, !1 = $potency, !2 = $strain
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   79     0  E >   ASSIGN                                                   !0, <array>
   80     1        FETCH_OBJ_R                                      ~4      'strains'
          2      > FE_RESET_R                                       $5      ~4, ->28
          3    > > FE_FETCH_R                                       ~6      $5, !1, ->28
          4    >   ASSIGN                                                   !2, ~6
   81     5        FETCH_OBJ_R                                      ~9      'strains'
          6        FETCH_DIM_R                                      ~10     ~9, 'cubensis'
          7        DIV                                              ~11     !1, ~10
          8        ASSIGN_OBJ                                               'dosageFactor'
          9        OP_DATA                                                  ~11
   82    10        INIT_FCALL                                               'ucfirst'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                         $14     
         13        CONCAT                                           ~15     'Psilocybin+', $14
         14        FETCH_DIM_W                                      $12     !0, !2
         15        ASSIGN_DIM                                               $12, 'name'
         16        OP_DATA                                                  ~15
   83    17        INIT_FCALL                                               'round'
         18        FETCH_OBJ_R                                      ~18     'microdose'
         19        FETCH_OBJ_R                                      ~19     'dosageFactor'
         20        DIV                                              ~20     ~18, ~19
         21        SEND_VAL                                                 ~20
         22        SEND_VAL                                                 2
         23        DO_ICALL                                         $21     
         24        FETCH_DIM_W                                      $16     !0, !2
         25        ASSIGN_DIM                                               $16, 'regular'
         26        OP_DATA                                                  $21
   80    27      > JMP                                                      ->3
         28    >   FE_FREE                                                  $5
   85    29      > RETURN                                                   !0
   86    30*     > RETURN                                                   null

End of function getregular

Function getheroic:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 28
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 28
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
filename:       /in/hPFiP
function name:  getHeroic
number of ops:  31
compiled vars:  !0 = $dose, !1 = $potency, !2 = $strain
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   89     0  E >   ASSIGN                                                   !0, <array>
   90     1        FETCH_OBJ_R                                      ~4      'strains'
          2      > FE_RESET_R                                       $5      ~4, ->28
          3    > > FE_FETCH_R                                       ~6      $5, !1, ->28
          4    >   ASSIGN                                                   !2, ~6
   91     5        FETCH_OBJ_R                                      ~9      'strains'
          6        FETCH_DIM_R                                      ~10     ~9, 'cubensis'
          7        DIV                                              ~11     !1, ~10
          8        ASSIGN_OBJ                                               'dosageFactor'
          9        OP_DATA                                                  ~11
   92    10        INIT_FCALL                                               'ucfirst'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                         $14     
         13        CONCAT                                           ~15     'Psilocybin+', $14
         14        FETCH_DIM_W                                      $12     !0, !2
         15        ASSIGN_DIM                                               $12, 'name'
         16        OP_DATA                                                  ~15
   93    17        INIT_FCALL                                               'round'
         18        FETCH_OBJ_R                                      ~18     'microdose'
         19        FETCH_OBJ_R                                      ~19     'dosageFactor'
         20        DIV                                              ~20     ~18, ~19
         21        SEND_VAL                                                 ~20
         22        SEND_VAL                                                 2
         23        DO_ICALL                                         $21     
         24        FETCH_DIM_W                                      $16     !0, !2
         25        ASSIGN_DIM                                               $16, 'heroic'
         26        OP_DATA                                                  $21
   90    27      > JMP                                                      ->3
         28    >   FE_FREE                                                  $5
   95    29      > RETURN                                                   !0
   96    30*     > RETURN                                                   null

End of function getheroic

End of class Mushroom.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
187.51 ms | 1420 KiB | 27 Q