3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Person { //Variables for personal information// private $navn; private $adresse; private $postnummer; private $poststed; private $telefonnummer; private $fodselsdato; public function __construct($navn, $adresse, $postnummer, $poststed, $telefonnummer, $fodselsdato) { $this->navn = $navn; $this->adresse = $adresse; $this->postnummer = $postnummer; $this->poststed = $poststed; $this->telefonnummer = $telefonnummer; $this->fodselsdato = $fodselsdato; } //Creates an array to store education for a person// private $utdanning = array(); //Function to add education to the array// public function leggTilUtdanning(Utdanning $utdanning) { $this->utdanning[] = $utdanning; } } //Class for education class Utdanning { private $institusjon; private $studieretning; private $grad; private $startet; private $ferdig; public function __construct($institusjon, $studieretning, $grad, $startet, $ferdig) { $this->institusjon = $institusjon; $this->studieretning = $studieretning; $this->grad = $grad; $this->startet = $startet; $this->ferdig = $ferdig; } } $person1 = new Person('Dave Lewis', 'Downing Street 14', 0442, 'Northville', 98765432, '17.05.1975'); $utdanning = new Utdanning('Harvard', 'Economics', 'Bachelor', 2013, 2016); $person1->leggTilUtdanning($utdanning);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G7flR
function name:  (null)
number of ops:  21
compiled vars:  !0 = $person1, !1 = $utdanning
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   48     0  E >   NEW                                              $2      'Person'
          1        SEND_VAL_EX                                              'Dave+Lewis'
          2        SEND_VAL_EX                                              'Downing+Street+14'
          3        SEND_VAL_EX                                              290
          4        SEND_VAL_EX                                              'Northville'
          5        SEND_VAL_EX                                              98765432
          6        SEND_VAL_EX                                              '17.05.1975'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !0, $2
   49     9        NEW                                              $5      'Utdanning'
         10        SEND_VAL_EX                                              'Harvard'
         11        SEND_VAL_EX                                              'Economics'
         12        SEND_VAL_EX                                              'Bachelor'
         13        SEND_VAL_EX                                              2013
         14        SEND_VAL_EX                                              2016
         15        DO_FCALL                                      0          
         16        ASSIGN                                                   !1, $5
   50    17        INIT_METHOD_CALL                                         !0, 'leggTilUtdanning'
         18        SEND_VAR_EX                                              !1
         19        DO_FCALL                                      0          
         20      > RETURN                                                   1

Class Person:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G7flR
function name:  __construct
number of ops:  19
compiled vars:  !0 = $navn, !1 = $adresse, !2 = $postnummer, !3 = $poststed, !4 = $telefonnummer, !5 = $fodselsdato
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV                                             !4      
          5        RECV                                             !5      
   14     6        ASSIGN_OBJ                                               'navn'
          7        OP_DATA                                                  !0
   15     8        ASSIGN_OBJ                                               'adresse'
          9        OP_DATA                                                  !1
   16    10        ASSIGN_OBJ                                               'postnummer'
         11        OP_DATA                                                  !2
   17    12        ASSIGN_OBJ                                               'poststed'
         13        OP_DATA                                                  !3
   18    14        ASSIGN_OBJ                                               'telefonnummer'
         15        OP_DATA                                                  !4
   19    16        ASSIGN_OBJ                                               'fodselsdato'
         17        OP_DATA                                                  !5
   20    18      > RETURN                                                   null

End of function __construct

Function leggtilutdanning:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G7flR
function name:  leggTilUtdanning
number of ops:  5
compiled vars:  !0 = $utdanning
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
   27     1        FETCH_OBJ_W                                      $1      'utdanning'
          2        ASSIGN_DIM                                               $1
          3        OP_DATA                                                  !0
   28     4      > RETURN                                                   null

End of function leggtilutdanning

End of class Person.

Class Utdanning:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G7flR
function name:  __construct
number of ops:  16
compiled vars:  !0 = $institusjon, !1 = $studieretning, !2 = $grad, !3 = $startet, !4 = $ferdig
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV                                             !4      
   41     5        ASSIGN_OBJ                                               'institusjon'
          6        OP_DATA                                                  !0
   42     7        ASSIGN_OBJ                                               'studieretning'
          8        OP_DATA                                                  !1
   43     9        ASSIGN_OBJ                                               'grad'
         10        OP_DATA                                                  !2
   44    11        ASSIGN_OBJ                                               'startet'
         12        OP_DATA                                                  !3
   45    13        ASSIGN_OBJ                                               'ferdig'
         14        OP_DATA                                                  !4
   46    15      > RETURN                                                   null

End of function __construct

End of class Utdanning.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.76 ms | 1004 KiB | 13 Q