3v4l.org

run code in 500+ PHP versions simultaneously
<?php // prelim $object = new stdClass; $object->field = 10; $param = new stdClass; $param->object = $object; // ternary variant $field = !($param && $param->object)?: $param->object->field; echo $field,"\n"; // alternative to ANDing $field = get_object_vars( $param->object )["field"] ?? null; echo $field,"\n";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/OZF61
function name:  (null)
number of ops:  32
compiled vars:  !0 = $object, !1 = $param, !2 = $field
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   NEW                                                  $3      'stdClass'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $3
    4     3        ASSIGN_OBJ                                                   !0, 'field'
          4        OP_DATA                                                      10
    5     5        NEW                                                  $7      'stdClass'
          6        DO_FCALL                                          0          
          7        ASSIGN                                                       !1, $7
    6     8        ASSIGN_OBJ                                                   !1, 'object'
          9        OP_DATA                                                      !0
    9    10      > JMPZ_EX                                              ~11     !1, ->13
         11    >   FETCH_OBJ_R                                          ~12     !1, 'object'
         12        BOOL                                                 ~11     ~12
         13    >   BOOL_NOT                                             ~13     ~11
         14        JMP_SET                                              ~14     ~13, ->18
         15        FETCH_OBJ_R                                          ~15     !1, 'object'
         16        FETCH_OBJ_R                                          ~16     ~15, 'field'
         17        QM_ASSIGN                                            ~14     ~16
         18        ASSIGN                                                       !2, ~14
   10    19        ECHO                                                         !2
         20        ECHO                                                         '%0A'
   13    21        INIT_FCALL                                                   'get_object_vars'
         22        FETCH_OBJ_R                                          ~18     !1, 'object'
         23        SEND_VAL                                                     ~18
         24        DO_ICALL                                             $19     
         25        FETCH_DIM_IS                                         ~20     $19, 'field'
         26        COALESCE                                             ~21     ~20
         27        QM_ASSIGN                                            ~21     null
         28        ASSIGN                                                       !2, ~21
   14    29        ECHO                                                         !2
         30        ECHO                                                         '%0A'
         31      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
216.44 ms | 1976 KiB | 14 Q