3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo 'hello there world!'; echo 'The date is... who cares?'; $thingy = new Thingy(); $thingy->setArray(['tit' => 'eh']); $thingy->displayIfIndexExists('tit'); class Thingy { private $array; // or in __construct(), also get public function setArray(Array $array) { $this->array = $array; } public function displayIfIndexExists($tit) { if (array_key_exists($tit, $this->array)) { echo $this->array[$tit]; } } public function getIndexIfExists($tit) { return (array_key_exists($tit, $this->array)) ? ($this->array[$tit]) : false; } } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aWLpW
function name:  (null)
number of ops:  12
compiled vars:  !0 = $thingy
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ECHO                                                     'hello+there+world%21'
    4     1        ECHO                                                     'The+date+is...+who+cares%3F'
    5     2        NEW                                              $1      'Thingy'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
    6     5        INIT_METHOD_CALL                                         !0, 'setArray'
          6        SEND_VAL_EX                                              <array>
          7        DO_FCALL                                      0          
    7     8        INIT_METHOD_CALL                                         !0, 'displayIfIndexExists'
          9        SEND_VAL_EX                                              'tit'
         10        DO_FCALL                                      0          
   34    11      > RETURN                                                   1

Class Thingy:
Function setarray:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aWLpW
function name:  setArray
number of ops:  4
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   16     1        ASSIGN_OBJ                                               'array'
          2        OP_DATA                                                  !0
   17     3      > RETURN                                                   null

End of function setarray

Function displayifindexexists:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/aWLpW
function name:  displayIfIndexExists
number of ops:  8
compiled vars:  !0 = $tit
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   21     1        FETCH_OBJ_R                                      ~1      'array'
          2        ARRAY_KEY_EXISTS                                         !0, ~1
          3      > JMPZ                                                     ~2, ->7
   23     4    >   FETCH_OBJ_R                                      ~3      'array'
          5        FETCH_DIM_R                                      ~4      ~3, !0
          6        ECHO                                                     ~4
   25     7    > > RETURN                                                   null

End of function displayifindexexists

Function getindexifexists:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aWLpW
function name:  getIndexIfExists
number of ops:  11
compiled vars:  !0 = $tit
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
   29     1        FETCH_OBJ_R                                      ~1      'array'
          2        ARRAY_KEY_EXISTS                                         !0, ~1
          3      > JMPZ                                                     ~2, ->8
          4    >   FETCH_OBJ_R                                      ~3      'array'
          5        FETCH_DIM_R                                      ~4      ~3, !0
          6        QM_ASSIGN                                        ~5      ~4
          7      > JMP                                                      ->9
          8    >   QM_ASSIGN                                        ~5      <false>
          9    > > RETURN                                                   ~5
   30    10*     > RETURN                                                   null

End of function getindexifexists

End of class Thingy.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.84 ms | 1390 KiB | 13 Q