3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bicycle { protected $condition_id; protected const CONDITION_OPTIONS = [ 1 => 'Beat up', 2 => 'Decent', 3 => 'Good', 4 => 'Great', 5 => 'Like New' ]; public function __construct($arg=[]){ $this->condition_id = $arg['condition_id'] ?? 3; } public function condition(){ if($this->condition_id > 0){ return self::CONDITION_OPTIONS[$this->condition_id]; }else{ return "Unknown"; } } } $arg = ['condition_id' => 2]; $bike = new Bicycle($arg); echo $bike->condition();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PA0WW
function name:  (null)
number of ops:  9
compiled vars:  !0 = $arg, !1 = $bike
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   ASSIGN                                                   !0, <array>
   32     1        NEW                                              $3      'Bicycle'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $3
   33     5        INIT_METHOD_CALL                                         !1, 'condition'
          6        DO_FCALL                                      0  $6      
          7        ECHO                                                     $6
          8      > RETURN                                                   1

Class Bicycle:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PA0WW
function name:  __construct
number of ops:  7
compiled vars:  !0 = $arg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV_INIT                                        !0      <array>
   15     1        FETCH_DIM_IS                                     ~2      !0, 'condition_id'
          2        COALESCE                                         ~3      ~2
          3        QM_ASSIGN                                        ~3      3
          4        ASSIGN_OBJ                                               'condition_id'
          5        OP_DATA                                                  ~3
   16     6      > RETURN                                                   null

End of function __construct

Function condition:
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
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PA0WW
function name:  condition
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   FETCH_OBJ_R                                      ~0      'condition_id'
          1        IS_SMALLER                                               0, ~0
          2      > JMPZ                                                     ~1, ->7
   21     3    >   FETCH_OBJ_R                                      ~2      'condition_id'
          4        FETCH_DIM_R                                      ~3      <array>, ~2
          5      > RETURN                                                   ~3
   20     6*       JMP                                                      ->8
   23     7    > > RETURN                                                   'Unknown'
   26     8*     > RETURN                                                   null

End of function condition

End of class Bicycle.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
267.83 ms | 1008 KiB | 13 Q