3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Parent class for custom model classes. * * This class was implemented like part of Observer pattern * https://en.wikipedia.org/wiki/Observer_pattern * http://php.net/manual/en/class.splsubject.php */ class Model implements SplSubject { /** * @var object List of attached observerer */ private $observers; /** * @var array Data for notify to observerer */ private $updates = []; /** * Class Constructor. */ public function __construct() { $this->observers = new SplObjectStorage(); } /** * Attach an Observer class to this Subject for updates * when occour a subject state change. * * @param SplObserver $observer */ public function attach(SplObserver $observer) { if ($observer instanceof View) { $this->observers->attach($observer); } } /** * Detach an Observer class from this Subject. * * @param SplObserver $observer */ public function detach(SplObserver $observer) { if ($observer instanceof View) { $this->observers->detach($observer); } } /** * Notify a state change of Subject to all registered Observeres. */ public function notify() { foreach ($this->observers as $value) { $value->update($this); } } /** * Set the data to notify to all registered Observeres. * * @param array $data */ public function set(array $data) { $this->updates = array_merge_recursive($this->updates, $data); } /** * Get the data to notify to all registered Observeres. * * @return array */ public function get(): array { return $this->updates; } } /** * Parent class for custom view classes. * * This class was implemented like part of Observer pattern * https://en.wikipedia.org/wiki/Observer_pattern * http://php.net/manual/en/class.splobserver.php */ class View implements SplObserver { /** * @var array Data for the dynamic view */ protected $data = []; /** * @var string Output data */ protected $output = ''; /** * @var Model Model for access data */ protected $model; /** * Class Constructor. * * @param Model $model */ public function __construct(Model $model) { $this->model = $model; } /** * Render a template. */ public function render(): string { return $this->output; } /** * Update Observer data. * * @param SplSubject $subject */ public function update(SplSubject $subject) { if ($subject instanceof Model) { $this->data = array_merge($this->data, $subject->get()); } } } /** * Parent class for custom controller classes. */ class Controller { /** * @var object The model object for current controller */ protected $model = null; /** * Class Constructor. * * @param object $model */ public function __construct(Model $model) { $this->model = $model; } } /** * Our Custom Model */ class CalculatorModel extends Model { /** * Class Constructor. */ public function __construct() { parent::__construct(); } /** * Mutiply business logic. * * @param array $numbers */ public function multiply(array $numbers) { $this->set([ 'result' => $this->operation('*', $numbers), 'operands' => $numbers, ]); } /** * Divide business logic. * * @param array $numbers */ public function divide(array $numbers) { $this->set([ 'result' => $this->operation('/', $numbers), 'operands' => $numbers ]); } /** * Subtraction business logic. * * @param array $numbers */ public function sub(array $numbers) { $this->set([ 'result' => $this->operation('-', $numbers), 'operands' => $numbers ]); } /** * Addition business logic. * * @param array $numbers */ public function add(array $numbers) { $this->set([ 'result' => $this->operation('+', $numbers), 'operands' => $numbers ]); } /** * Do math operation. * This is an example, division by 0 and other problematic things not checked. * * @param string $operator * @param array $numbers * @return int|float */ private function operation(string $operator, array $numbers) { $temp = null; foreach ($numbers as $n) { if ($temp === null) { $temp = $n; continue; } //example, division by 0 and other not checked switch ($operator) { case '*': $temp = $temp * $n; break; case '/': $temp = $temp / $n; break; case '-': $temp = $temp - $n; break; case '+': $temp = $temp + $n; break; } } return $temp; } } /** * Our Custom Model */ class CalculatorView extends View { /** * Class Constructor. * * @param CalculatorModel $model */ public function __construct(CalculatorModel $model) { parent::__construct($model); } /** * Build output for multiply. */ public function multiply() { $this->output = $this->generateOutput( 'Multiplication', $this->data['operands'], $this->data['result'] ); } /** * Build output for divide. */ public function divide() { $this->output = $this->generateOutput( 'Division', $this->data['operands'], $this->data['result'] ); } /** * Build output for add. */ public function add() { $this->output = $this->generateOutput( 'Addiction', $this->data['operands'], $this->data['result'] ); } /** * Build output for sub. */ public function sub() { $this->output = $this->generateOutput( 'Subtraction', $this->data['operands'], $this->data['result'] ); } /** * Generate the output. * * @param string $operation * @param array $operand * @param type $result * * @return string */ private function generateOutput(string $operation, array $operands, $result): string { $string = $operation . ': '; foreach ($operands as $value) { $string .= $value . ' * '; } $string = substr($string, 0, strlen($string) - 2); $string .= '= ' . $result; return $string; } } /** * Our Custom Controller */ class CalculatorController extends Controller { /** * Class Constructor. * * @param CalculatorModel $model */ public function __construct(CalculatorModel $model) { parent::__construct($model); } /** * Multiply input point. * * @param mixed $numbers */ public function multiply(... $numbers) { //check user input $this->checkOperands($numbers); $this->filter($numbers); //manipulate the model $this->model->multiply($numbers); } /** * Divide input point. * * @param mixed $numbers */ public function divide(... $numbers) { //check user input $this->checkOperands($numbers); $this->filter($numbers); //manipulate the model $this->model->divide($numbers); } /** * Sub input point. * * @param mixed $numbers */ public function sub(... $numbers) { //check user input $this->checkOperands($numbers); $this->filter($numbers); //manipulate the model $this->model->sub($numbers); } /** * Add input point. * * @param mixed $numbers */ public function add(... $numbers) { //check user input $this->checkOperands($numbers); $this->filter($numbers); //manipulate the model $this->model->add($numbers); } /** * Filter user supplied numbers. * * @param mixed $numbers * @throws InvalidArgumentException */ private function filter(&$numbers) { foreach ($numbers as $key => $number) { switch (gettype($number)) { case 'string': $number[$key] = strtonum($number); break; case 'integer': break; case 'double': break; default: throw new InvalidArgumentException('Not a number'); } } } /** * Convert a number given as string in the proper type (int or float). * https://secure.php.net/manual/en/language.types.type-juggling.php * * @param string $string Number as string ex '1.0', '0.9' etc * @return int|float */ private function strtonum(string $string) { if (fmod((float) $string, 1.0) === 0.0) { return (int) $string; } return (float) $string; } /** * Check minimum numbers required for operations. * * @param array $numbers * @throws ArgumentCountError */ private function checkOperands(array &$numbers) { if (count($numbers) < 2) { throw new ArgumentCountError('Two number needed for operation'); } } } //create components $model = new CalculatorModel(); $view = new CalculatorView($model); $controller = new CalculatorController($model); //attach the observer $model->attach($view); //call controller $controller->multiply(2, 3); //notify changes to observer $model->notify(); //call view, build output for selected operation $view->multiply(); //get the output echo $view->render();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6Rprp
function name:  (null)
number of ops:  30
compiled vars:  !0 = $model, !1 = $view, !2 = $controller
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   DECLARE_CLASS                                            'model'
   88     1        DECLARE_CLASS                                            'view'
  158     2        DECLARE_CLASS                                            'calculatormodel', 'model'
  256     3        DECLARE_CLASS                                            'calculatorview', 'view'
  462     4        NEW                                              $3      'CalculatorModel'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $3
  463     7        NEW                                              $6      'CalculatorView'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !1, $6
  464    11        NEW                                              $9      'CalculatorController'
         12        SEND_VAR_EX                                              !0
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !2, $9
  467    15        INIT_METHOD_CALL                                         !0, 'attach'
         16        SEND_VAR_EX                                              !1
         17        DO_FCALL                                      0          
  470    18        INIT_METHOD_CALL                                         !2, 'multiply'
         19        SEND_VAL_EX                                              2
         20        SEND_VAL_EX                                              3
         21        DO_FCALL                                      0          
  473    22        INIT_METHOD_CALL                                         !0, 'notify'
         23        DO_FCALL                                      0          
  476    24        INIT_METHOD_CALL                                         !1, 'multiply'
         25        DO_FCALL                                      0          
  479    26        INIT_METHOD_CALL                                         !1, 'render'
         27        DO_FCALL                                      0  $16     
         28        ECHO                                                     $16
         29      > RETURN                                                   1

Class Model:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6Rprp
function name:  __construct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   NEW                                              $1      'SplObjectStorage'
          1        DO_FCALL                                      0          
          2        ASSIGN_OBJ                                               'observers'
          3        OP_DATA                                                  $1
   27     4      > RETURN                                                   null

End of function __construct

Function attach:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/6Rprp
function name:  attach
number of ops:  8
compiled vars:  !0 = $observer
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   RECV                                             !0      
   36     1        INSTANCEOF                                               !0, 'View'
          2      > JMPZ                                                     ~1, ->7
   37     3    >   FETCH_OBJ_R                                      ~2      'observers'
          4        INIT_METHOD_CALL                                         ~2, 'attach'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   39     7    > > RETURN                                                   null

End of function attach

Function detach:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/6Rprp
function name:  detach
number of ops:  8
compiled vars:  !0 = $observer
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   46     0  E >   RECV                                             !0      
   47     1        INSTANCEOF                                               !0, 'View'
          2      > JMPZ                                                     ~1, ->7
   48     3    >   FETCH_OBJ_R                                      ~2      'observers'
          4        INIT_METHOD_CALL                                         ~2, 'detach'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   50     7    > > RETURN                                                   null

End of function detach

Function notify:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 8
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/6Rprp
function name:  notify
number of ops:  10
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   56     0  E >   FETCH_OBJ_R                                      ~1      'observers'
          1      > FE_RESET_R                                       $2      ~1, ->8
          2    > > FE_FETCH_R                                               $2, !0, ->8
   57     3    >   INIT_METHOD_CALL                                         !0, 'update'
          4        FETCH_THIS                                       $3      
          5        SEND_VAR_EX                                              $3
          6        DO_FCALL                                      0          
   56     7      > JMP                                                      ->2
          8    >   FE_FREE                                                  $2
   59     9      > RETURN                                                   null

End of function notify

Function set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6Rprp
function name:  set
number of ops:  9
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   66     0  E >   RECV                                             !0      
   67     1        INIT_FCALL                                               'array_merge_recursive'
          2        FETCH_OBJ_R                                      ~2      'updates'
          3        SEND_VAL                                                 ~2
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $3      
          6        ASSIGN_OBJ                                               'updates'
          7        OP_DATA                                                  $3
   68     8      > RETURN                                                   null

End of function set

Function get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6Rprp
function name:  get
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   76     0  E >   FETCH_OBJ_R                                      ~0      'updates'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   77     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function get

End of class Model.

Class View:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6Rprp
function name:  __construct
number of ops:  4
compiled vars:  !0 = $model
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  110     0  E >   RECV                                             !0      
  111     1        ASSIGN_OBJ                                               'model'
          2        OP_DATA                                                  !0
  112     3      > RETURN                                                   null

End of function __construct

Function render:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6Rprp
function name:  render
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  118     0  E >   FETCH_OBJ_R                                      ~0      'output'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
  119     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function render

Function update:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 12
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/6Rprp
function name:  update
number of ops:  13
compiled vars:  !0 = $subject
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  126     0  E >   RECV                                             !0      
  127     1        INSTANCEOF                                               !0, 'Model'
          2      > JMPZ                                                     ~1, ->12
  128     3    >   INIT_FCALL                                               'array_merge'
          4        FETCH_OBJ_R                                      ~3      'data'
          5        SEND_VAL                                                 ~3
          6        INIT_METHOD_CALL                                         !0, 'get'
          7        DO_FCALL                                      0  $4      
          8        SEND_VAR                                                 $4
          9        DO_ICALL                                         $5      
         10        ASSIGN_OBJ                                               'data'
         11        OP_DATA                                                  $5
  130    12    > > RETURN                                                   null

End of function update

End of class View.

Class Controller:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6Rprp
function name:  __construct
number of ops:  4
compiled vars:  !0 = $model
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  149     0  E >   RECV                                             !0      
  150     1        ASSIGN_OBJ                                               'model'
          2        OP_DATA                                                  !0
  151     3      > RETURN                                                   null

End of function __construct

End of class Controller.

Class CalculatorModel:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6Rprp
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  164     0  E >   INIT_STATIC_METHOD_CALL                                  
          1        DO_FCALL                                      0          
  165     2      > RETURN                                                   null

End of function __construct

Function multiply:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6Rprp
function name:  multiply
number of ops:  11
compiled vars:  !0 = $numbers
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  172     0  E >   RECV                                             !0      
  173     1        INIT_METHOD_CALL                                         'set'
  174     2        INIT_METHOD_CALL                                         'operation'
          3        SEND_VAL_EX                                              '%2A'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $1      
          6        INIT_ARRAY                                       ~2      $1, 'result'
  175     7        ADD_ARRAY_ELEMENT                                ~2      !0, 'operands'
          8        SEND_VAL_EX                                              ~2
  173     9        DO_FCALL                                      0          
  177    10      > RETURN                                                   null

End of function multiply

Function divide:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6Rprp
function name:  divide
number of ops:  11
compiled vars:  !0 = $numbers
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  184     0  E >   RECV                                             !0      
  185     1        INIT_METHOD_CALL                                         'set'
  186     2        INIT_METHOD_CALL                                         'operation'
          3        SEND_VAL_EX                                              '%2F'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $1      
          6        INIT_ARRAY                                       ~2      $1, 'result'
  187     7        ADD_ARRAY_ELEMENT                                ~2      !0, 'operands'
          8        SEND_VAL_EX                                              ~2
  185     9        DO_FCALL                                      0          
  189    10      > RETURN                                                   null

End of function divide

Function sub:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6Rprp
function name:  sub
number of ops:  11
compiled vars:  !0 = $numbers
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  196     0  E >   RECV                                             !0      
  197     1        INIT_METHOD_CALL                                         'set'
  198     2        INIT_METHOD_CALL                                         'operation'
          3        SEND_VAL_EX                                              '-'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $1      
          6        INIT_ARRAY                                       ~2      $1, 'result'
  199     7        ADD_ARRAY_ELEMENT                                ~2      !0, 'operands'
          8        SEND_VAL_EX                                              ~2
  197     9        DO_FCALL                                      0          
  201    10      > RETURN                                                   null

End of function sub

Function add:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6Rprp
function name:  add
number of ops:  11
compiled vars:  !0 = $numbers
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  208     0  E >   RECV                                             !0      
  209     1        INIT_METHOD_CALL                                         'set'
  210     2        INIT_METHOD_CALL                                         'operation'
          3        SEND_VAL_EX                                              '%2B'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $1      
          6        INIT_ARRAY                                       ~2      $1, 'result'
  211     7        ADD_ARRAY_ELEMENT                                ~2      !0, 'operands'
          8        SEND_VAL_EX                                              ~2
  209     9        DO_FCALL                                      0          
  213    10      > RETURN                                                   null

End of function add

Function operation:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 32
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 32
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 9
6 jumps found. (Code = 188) Position 1 = 19, Position 2 = 22, Position 3 = 25, Position 4 = 28, Position 5 = 31, Position 6 = 10
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
Branch analysis from position: 31
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 19
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 22
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 25
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 28
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
Branch analysis from position: 28
Branch analysis from position: 25
Branch analysis from position: 22
Branch analysis from position: 19
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/6Rprp
function name:  operation
number of ops:  35
compiled vars:  !0 = $operator, !1 = $numbers, !2 = $temp, !3 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  223     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  224     2        ASSIGN                                                   !2, null
  225     3      > FE_RESET_R                                       $5      !1, ->32
          4    > > FE_FETCH_R                                               $5, !3, ->32
  226     5    >   TYPE_CHECK                                    2          !2
          6      > JMPZ                                                     ~6, ->9
  227     7    >   ASSIGN                                                   !2, !3
  228     8      > JMP                                                      ->4
  232     9    > > SWITCH_STRING                                            !0, [ '%2A':->19, '%2F':->22, '-':->25, '%2B':->28, ], ->31
  233    10    >   IS_EQUAL                                                 !0, '%2A'
         11      > JMPNZ                                                    ~8, ->19
  236    12    >   IS_EQUAL                                                 !0, '%2F'
         13      > JMPNZ                                                    ~8, ->22
  239    14    >   IS_EQUAL                                                 !0, '-'
         15      > JMPNZ                                                    ~8, ->25
  242    16    >   IS_EQUAL                                                 !0, '%2B'
         17      > JMPNZ                                                    ~8, ->28
         18    > > JMP                                                      ->31
  234    19    >   MUL                                              ~9      !2, !3
         20        ASSIGN                                                   !2, ~9
  235    21      > JMP                                                      ->31
  237    22    >   DIV                                              ~11     !2, !3
         23        ASSIGN                                                   !2, ~11
  238    24      > JMP                                                      ->31
  240    25    >   SUB                                              ~13     !2, !3
         26        ASSIGN                                                   !2, ~13
  241    27      > JMP                                                      ->31
  243    28    >   ADD                                              ~15     !2, !3
         29        ASSIGN                                                   !2, ~15
  244    30      > JMP                                                      ->31
  225    31    > > JMP                                                      ->4
         32    >   FE_FREE                                                  $5
  248    33      > RETURN                                                   !2
  249    34*     > RETURN                                                   null

End of function operation

End of class CalculatorModel.

Class CalculatorView:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6Rprp
function name:  __construct
number of ops:  5
compiled vars:  !0 = $model
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  263     0  E >   RECV                                             !0      
  264     1        INIT_STATIC_METHOD_CALL                                  
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
  265     4      > RETURN                                                   null

End of function __construct

Function multiply:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6Rprp
function name:  multiply
number of ops:  14
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  272     0  E >   INIT_METHOD_CALL                                         'generateOutput'
  273     1        SEND_VAL_EX                                              'Multiplication'
          2        CHECK_FUNC_ARG                                           
  274     3        FETCH_OBJ_FUNC_ARG                               $1      'data'
          4        FETCH_DIM_FUNC_ARG                               $2      $1, 'operands'
          5        SEND_FUNC_ARG                                            $2
          6        CHECK_FUNC_ARG                                           
  275     7        FETCH_OBJ_FUNC_ARG                               $3      'data'
          8        FETCH_DIM_FUNC_ARG                               $4      $3, 'result'
          9        SEND_FUNC_ARG                                            $4
  272    10        DO_FCALL                                      0  $5      
         11        ASSIGN_OBJ                                               'output'
  275    12        OP_DATA                                                  $5
  277    13      > RETURN                                                   null

End of function multiply

Function divide:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6Rprp
function name:  divide
number of ops:  14
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  283     0  E >   INIT_METHOD_CALL                                         'generateOutput'
  284     1        SEND_VAL_EX                                              'Division'
          2        CHECK_FUNC_ARG                                           
  285     3        FETCH_OBJ_FUNC_ARG                               $1      'data'
          4        FETCH_DIM_FUNC_ARG                               $2      $1, 'operands'
          5        SEND_FUNC_ARG                                            $2
          6        CHECK_FUNC_ARG                                           
  286     7        FETCH_OBJ_FUNC_ARG                               $3      'data'
          8        FETCH_DIM_FUNC_ARG                               $4      $3, 'result'
          9        SEND_FUNC_ARG                                            $4
  283    10        DO_FCALL                                      0  $5      
         11        ASSIGN_OBJ                                               'output'
  286    12        OP_DATA                                                  $5
  288    13      > RETURN                                                   null

End of function divide

Function add:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6Rprp
function name:  add
number of ops:  14
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  294     0  E >   INIT_METHOD_CALL                                         'generateOutput'
  295     1        SEND_VAL_EX                                              'Addiction'
          2        CHECK_FUNC_ARG                                           
  296     3        FETCH_OBJ_FUNC_ARG                               $1      'data'
          4        FETCH_DIM_FUNC_ARG                               $2      $1, 'operands'
          5        SEND_FUNC_ARG                                            $2
          6        CHECK_FUNC_ARG                                           
  297     7        FETCH_OBJ_FUNC_ARG                               $3      'data'
          8        FETCH_DIM_FUNC_ARG                               $4      $3, 'result'
          9        SEND_FUNC_ARG                                            $4
  294    10        DO_FCALL                                      0  $5      
         11        ASSIGN_OBJ                                               'output'
  297    12        OP_DATA                                                  $5
  299    13      > RETURN                                                   null

End of function add

Function sub:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6Rprp
function name:  sub
number of ops:  14
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  305     0  E >   INIT_METHOD_CALL                                         'generateOutput'
  306     1        SEND_VAL_EX                                              'Subtraction'
          2        CHECK_FUNC_ARG                                           
  307     3        FETCH_OBJ_FUNC_ARG                               $1      'data'
          4        FETCH_DIM_FUNC_ARG                               $2      $1, 'operands'
          5        SEND_FUNC_ARG                                            $2
          6        CHECK_FUNC_ARG                                           
  308     7        FETCH_OBJ_FUNC_ARG                               $3      'data'
          8        FETCH_DIM_FUNC_ARG                               $4      $3, 'result'
          9        SEND_FUNC_ARG                                            $4
  305    10        DO_FCALL                                      0  $5      
         11        ASSIGN_OBJ                                               'output'
  308    12        OP_DATA                                                  $5
  310    13      > RETURN                                                   null

End of function sub

Function generateoutput:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/6Rprp
function name:  generateOutput
number of ops:  25
compiled vars:  !0 = $operation, !1 = $operands, !2 = $result, !3 = $string, !4 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  321     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
  322     3        CONCAT                                           ~5      !0, '%3

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.05 ms | 1471 KiB | 15 Q