3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_message($data) { if (isset($data['message'])) { $message = $data['message']; } else { $message = 'no message'; } return $message; } function get_message_nullcoalesce($data) { return $data['message'] ?? 'no message'; } $data = []; echo get_message($data); echo get_message_nullcoalesce($data);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2AS7W
function name:  (null)
number of ops:  10
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   ASSIGN                                                   !0, <array>
   18     1        INIT_FCALL                                               'get_message'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
   19     5        INIT_FCALL                                               'get_message_nullcoalesce'
          6        SEND_VAR                                                 !0
          7        DO_FCALL                                      0  $3      
          8        ECHO                                                     $3
          9      > RETURN                                                   1

Function get_message:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2AS7W
function name:  get_message
number of ops:  9
compiled vars:  !0 = $data, !1 = $message
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ISSET_ISEMPTY_DIM_OBJ                         0          !0, 'message'
          2      > JMPZ                                                     ~2, ->6
    5     3    >   FETCH_DIM_R                                      ~3      !0, 'message'
          4        ASSIGN                                                   !1, ~3
          5      > JMP                                                      ->7
    7     6    >   ASSIGN                                                   !1, 'no+message'
   10     7    > > RETURN                                                   !1
   11     8*     > RETURN                                                   null

End of function get_message

Function get_message_nullcoalesce:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2AS7W
function name:  get_message_nullcoalesce
number of ops:  6
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        FETCH_DIM_IS                                     ~1      !0, 'message'
          2        COALESCE                                         ~2      ~1
          3        QM_ASSIGN                                        ~2      'no+message'
          4      > RETURN                                                   ~2
   15     5*     > RETURN                                                   null

End of function get_message_nullcoalesce

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.73 ms | 1399 KiB | 15 Q