3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Input { /** @var array $attributes */ private $attributes = []; /** * @param $key * @return mixed|string */ public function getAttribute($key) { return isset($this->attributes[$key]) ? $this->attributes[$key] : null; } /** * @param $key * @param $value * @return $this */ public function setAttribute($key, $value) { $this->attributes[$key] = $value; return $this; } /** * @param array $attributes * @return $this */ public function setAttributes(array $attributes) { $this->attributes = $attributes; return $this; } /** * @return array */ public function getAttributes() { return $this->attributes; } public function render() { $html = '<input '; foreach ($this->getAttributes() as $key => $val) { $html .= $key.'="'.$val.'" '; } $html .= '/>'; return $html; } } $input = new Input(); $input->setAttribute('id', 'pr_id') ->setAttribute('name', 'project_id') ->setAttribute('type', 'text'); echo $input->render();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sAiWd
function name:  (null)
number of ops:  19
compiled vars:  !0 = $input
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   58     0  E >   NEW                                              $1      'Input'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   59     3        INIT_METHOD_CALL                                         !0, 'setAttribute'
          4        SEND_VAL_EX                                              'id'
          5        SEND_VAL_EX                                              'pr_id'
          6        DO_FCALL                                      0  $4      
   60     7        INIT_METHOD_CALL                                         $4, 'setAttribute'
          8        SEND_VAL_EX                                              'name'
          9        SEND_VAL_EX                                              'project_id'
         10        DO_FCALL                                      0  $5      
   61    11        INIT_METHOD_CALL                                         $5, 'setAttribute'
         12        SEND_VAL_EX                                              'type'
         13        SEND_VAL_EX                                              'text'
         14        DO_FCALL                                      0          
   63    15        INIT_METHOD_CALL                                         !0, 'render'
         16        DO_FCALL                                      0  $7      
         17        ECHO                                                     $7
         18      > RETURN                                                   1

Class Input:
Function getattribute:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sAiWd
function name:  getAttribute
number of ops:  11
compiled vars:  !0 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   14     1        FETCH_OBJ_IS                                     ~1      'attributes'
          2        ISSET_ISEMPTY_DIM_OBJ                         0          ~1, !0
          3      > JMPZ                                                     ~2, ->8
          4    >   FETCH_OBJ_R                                      ~3      'attributes'
          5        FETCH_DIM_R                                      ~4      ~3, !0
          6        QM_ASSIGN                                        ~5      ~4
          7      > JMP                                                      ->9
          8    >   QM_ASSIGN                                        ~5      null
          9    > > RETURN                                                   ~5
   15    10*     > RETURN                                                   null

End of function getattribute

Function setattribute:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sAiWd
function name:  setAttribute
number of ops:  8
compiled vars:  !0 = $key, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   24     2        FETCH_OBJ_W                                      $2      'attributes'
          3        ASSIGN_DIM                                               $2, !0
          4        OP_DATA                                                  !1
   25     5        FETCH_THIS                                       ~4      
          6      > RETURN                                                   ~4
   26     7*     > RETURN                                                   null

End of function setattribute

Function setattributes:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sAiWd
function name:  setAttributes
number of ops:  6
compiled vars:  !0 = $attributes
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV                                             !0      
   34     1        ASSIGN_OBJ                                               'attributes'
          2        OP_DATA                                                  !0
   35     3        FETCH_THIS                                       ~2      
          4      > RETURN                                                   ~2
   36     5*     > RETURN                                                   null

End of function setattributes

Function getattributes:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sAiWd
function name:  getAttributes
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   43     0  E >   FETCH_OBJ_R                                      ~0      'attributes'
          1      > RETURN                                                   ~0
   44     2*     > RETURN                                                   null

End of function getattributes

Function render:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 11
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 11
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/sAiWd
function name:  render
number of ops:  15
compiled vars:  !0 = $html, !1 = $val, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   48     0  E >   ASSIGN                                                   !0, '%3Cinput+'
   49     1        INIT_METHOD_CALL                                         'getAttributes'
          2        DO_FCALL                                      0  $4      
          3      > FE_RESET_R                                       $5      $4, ->11
          4    > > FE_FETCH_R                                       ~6      $5, !1, ->11
          5    >   ASSIGN                                                   !2, ~6
   50     6        CONCAT                                           ~8      !2, '%3D%22'
          7        CONCAT                                           ~9      ~8, !1
          8        CONCAT                                           ~10     ~9, '%22+'
          9        ASSIGN_OP                                     8          !0, ~10
   49    10      > JMP                                                      ->4
         11    >   FE_FREE                                                  $5
   52    12        ASSIGN_OP                                     8          !0, '%2F%3E'
   53    13      > RETURN                                                   !0
   54    14*     > RETURN                                                   null

End of function render

End of class Input.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.64 ms | 1016 KiB | 13 Q