3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Cookpedia_Entry { private $data = [ 'id' => 0, 'title' => null, 'latin_title' => null, 'category' => 0, 'calories' => 0, 'proteins' => 0, 'fats' => 0, 'carbohydrates' => 0, 'description' => null, 'tags' => null, 'measures' => [], ]; public function hydrate(PDO $dbh, int $id): void { $stmt = $dbh->prepare("SELECT `title`, `latin_title`, `category`, `calories`, `proteins`, `fats`, `carbohydrates`, `description`, `measures`, `tags` FROM `cook_encyclopedia_entries` WHERE `id`=:id"); $result = $stmt->execute($id); $this->data = $result->fetch(PDO::FETCH_ASSOC); } public function getData(): array { return $this->data; } public function getMeasures(): array { $measures = explode('|',$this->data['measures']); return [ 'g_in_tsp' => $measures[0], 'g_in_tbsp' => $measures[1], 'g_in_glass' => $measures[2], 'g_in_cup' => $measures[3], ]; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fhfEQ
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E > > RETURN                                                   1

Class Cookpedia_Entry:
Function hydrate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fhfEQ
function name:  hydrate
number of ops:  16
compiled vars:  !0 = $dbh, !1 = $id, !2 = $stmt, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   20     2        INIT_METHOD_CALL                                         !0, 'prepare'
          3        SEND_VAL_EX                                              'SELECT+%60title%60%2C+%60latin_title%60%2C+%60category%60%2C+%60calories%60%2C+%60proteins%60%2C+%60fats%60%2C+%60carbohydrates%60%2C+%60description%60%2C+%60measures%60%2C+%60tags%60+FROM+%60cook_encyclopedia_entries%60+WHERE+%60id%60%3D%3Aid'
          4        DO_FCALL                                      0  $4      
          5        ASSIGN                                                   !2, $4
   21     6        INIT_METHOD_CALL                                         !2, 'execute'
          7        SEND_VAR_EX                                              !1
          8        DO_FCALL                                      0  $6      
          9        ASSIGN                                                   !3, $6
   22    10        INIT_METHOD_CALL                                         !3, 'fetch'
         11        SEND_VAL_EX                                              2
         12        DO_FCALL                                      0  $9      
         13        ASSIGN_OBJ                                               'data'
         14        OP_DATA                                                  $9
   23    15      > RETURN                                                   null

End of function hydrate

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

End of function getdata

Function getmeasures:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fhfEQ
function name:  getMeasures
number of ops:  19
compiled vars:  !0 = $measures
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   INIT_FCALL                                               'explode'
          1        SEND_VAL                                                 '%7C'
          2        FETCH_OBJ_R                                      ~1      'data'
          3        FETCH_DIM_R                                      ~2      ~1, 'measures'
          4        SEND_VAL                                                 ~2
          5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !0, $3
   35     7        FETCH_DIM_R                                      ~5      !0, 0
          8        INIT_ARRAY                                       ~6      ~5, 'g_in_tsp'
   36     9        FETCH_DIM_R                                      ~7      !0, 1
         10        ADD_ARRAY_ELEMENT                                ~6      ~7, 'g_in_tbsp'
   37    11        FETCH_DIM_R                                      ~8      !0, 2
         12        ADD_ARRAY_ELEMENT                                ~6      ~8, 'g_in_glass'
   38    13        FETCH_DIM_R                                      ~9      !0, 3
         14        ADD_ARRAY_ELEMENT                                ~6      ~9, 'g_in_cup'
         15        VERIFY_RETURN_TYPE                                       ~6
         16      > RETURN                                                   ~6
   40    17*       VERIFY_RETURN_TYPE                                       
         18*     > RETURN                                                   null

End of function getmeasures

End of class Cookpedia_Entry.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.12 ms | 1400 KiB | 15 Q