3v4l.org

run code in 300+ PHP versions simultaneously
<?php class planDTO { public $plans; public function __construct($plans) { $this->plans = $plans; } public function checkValue($planId) { foreach ($this->plans as $k => $plan) { if ($plan['eventId'] == $planId) { $this->plans = $plan; return $this; } } } } $arrPlanDTO = [0 => ["eventId" => 1, "planId" => 1, "name" => "student only"], 1 => ["eventId" => 2, "planId" => 2, "name" => "employee only"], 2 => ["eventId" => 3, "planId" => 3, "name" => "individual only"]]; $objPlan = new planDTO($arrPlanDTO); $v = $objPlan->checkValue(2); print_r($v);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u1JtQ
function name:  (null)
number of ops:  13
compiled vars:  !0 = $arrPlanDTO, !1 = $objPlan, !2 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   ASSIGN                                                   !0, <array>
   21     1        NEW                                              $4      'planDTO'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $4
   22     5        INIT_METHOD_CALL                                         !1, 'checkValue'
          6        SEND_VAL_EX                                              2
          7        DO_FCALL                                      0  $7      
          8        ASSIGN                                                   !2, $7
   23     9        INIT_FCALL                                               'print_r'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

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

End of function __construct

Function checkvalue:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 14
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 14
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/u1JtQ
function name:  checkValue
number of ops:  16
compiled vars:  !0 = $planId, !1 = $plan, !2 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   11     1        FETCH_OBJ_R                                      ~3      'plans'
          2      > FE_RESET_R                                       $4      ~3, ->14
          3    > > FE_FETCH_R                                       ~5      $4, !1, ->14
          4    >   ASSIGN                                                   !2, ~5
   12     5        FETCH_DIM_R                                      ~7      !1, 'eventId'
          6        IS_EQUAL                                                 !0, ~7
          7      > JMPZ                                                     ~8, ->13
   13     8    >   ASSIGN_OBJ                                               'plans'
          9        OP_DATA                                                  !1
   14    10        FETCH_THIS                                       ~10     
         11        FE_FREE                                                  $4
         12      > RETURN                                                   ~10
   11    13    > > JMP                                                      ->3
         14    >   FE_FREE                                                  $4
   17    15      > RETURN                                                   null

End of function checkvalue

End of class planDTO.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.33 ms | 1400 KiB | 15 Q