3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Cookpedia; class 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); $this->data['measures'] = $this->computeMeasures($this->data['measures']); } public function getData(): array { return $this->data; } private function computeMeasures(string $measures): array { $measureArray = explode('|', $measures); return [ 'g_in_tsp' => $measureArray[0], 'g_in_tbsp' => $measureArray[1], 'g_in_glass' => $measureArray[2], 'g_in_cup' => $measureArray[3], ]; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nHP59
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   45     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/nHP59
function name:  hydrate
number of ops:  26
compiled vars:  !0 = $dbh, !1 = $id, !2 = $stmt, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   22     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
   23     6        INIT_METHOD_CALL                                         !2, 'execute'
          7        SEND_VAR_EX                                              !1
          8        DO_FCALL                                      0  $6      
          9        ASSIGN                                                   !3, $6
   25    10        INIT_METHOD_CALL                                         !3, 'fetch'
         11        FETCH_CLASS_CONSTANT                             ~9      'Cookpedia%5CPDO', 'FETCH_ASSOC'
         12        SEND_VAL_EX                                              ~9
         13        DO_FCALL                                      0  $10     
         14        ASSIGN_OBJ                                               'data'
         15        OP_DATA                                                  $10
   26    16        INIT_METHOD_CALL                                         'computeMeasures'
         17        CHECK_FUNC_ARG                                           
         18        FETCH_OBJ_FUNC_ARG                               $13     'data'
         19        FETCH_DIM_FUNC_ARG                               $14     $13, 'measures'
         20        SEND_FUNC_ARG                                            $14
         21        DO_FCALL                                      0  $15     
         22        FETCH_OBJ_W                                      $11     'data'
         23        ASSIGN_DIM                                               $11, 'measures'
         24        OP_DATA                                                  $15
   27    25      > 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/nHP59
function name:  getData
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   FETCH_OBJ_R                                      ~0      'data'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   32     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function getdata

Function computemeasures:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nHP59
function name:  computeMeasures
number of ops:  18
compiled vars:  !0 = $measures, !1 = $measureArray
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   RECV                                             !0      
   36     1        INIT_NS_FCALL_BY_NAME                                    'Cookpedia%5Cexplode'
          2        SEND_VAL_EX                                              '%7C'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $2      
          5        ASSIGN                                                   !1, $2
   39     6        FETCH_DIM_R                                      ~4      !1, 0
          7        INIT_ARRAY                                       ~5      ~4, 'g_in_tsp'
   40     8        FETCH_DIM_R                                      ~6      !1, 1
          9        ADD_ARRAY_ELEMENT                                ~5      ~6, 'g_in_tbsp'
   41    10        FETCH_DIM_R                                      ~7      !1, 2
         11        ADD_ARRAY_ELEMENT                                ~5      ~7, 'g_in_glass'
   42    12        FETCH_DIM_R                                      ~8      !1, 3
         13        ADD_ARRAY_ELEMENT                                ~5      ~8, 'g_in_cup'
         14        VERIFY_RETURN_TYPE                                       ~5
         15      > RETURN                                                   ~5
   44    16*       VERIFY_RETURN_TYPE                                       
         17*     > RETURN                                                   null

End of function computemeasures

End of class Cookpedia\Entry.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.41 ms | 1400 KiB | 15 Q