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'; } function get_message_ternary($data) { return isset($data['message']) ? $data['message'] : 'no message'; } $data = []; echo get_message($data) . "\n"; echo get_message_ternary($data) . "\n"; echo get_message_nullcoalesce($data) . "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aqS5Z
function name:  (null)
number of ops:  17
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   ASSIGN                                                   !0, <array>
   22     1        INIT_FCALL                                               'get_message'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        CONCAT                                           ~3      $2, '%0A'
          5        ECHO                                                     ~3
   23     6        INIT_FCALL                                               'get_message_ternary'
          7        SEND_VAR                                                 !0
          8        DO_FCALL                                      0  $4      
          9        CONCAT                                           ~5      $4, '%0A'
         10        ECHO                                                     ~5
   24    11        INIT_FCALL                                               'get_message_nullcoalesce'
         12        SEND_VAR                                                 !0
         13        DO_FCALL                                      0  $6      
         14        CONCAT                                           ~7      $6, '%0A'
         15        ECHO                                                     ~7
         16      > 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/aqS5Z
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/aqS5Z
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

Function get_message_ternary:
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/aqS5Z
function name:  get_message_ternary
number of ops:  9
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        ISSET_ISEMPTY_DIM_OBJ                         0          !0, 'message'
          2      > JMPZ                                                     ~1, ->6
          3    >   FETCH_DIM_R                                      ~2      !0, 'message'
          4        QM_ASSIGN                                        ~3      ~2
          5      > JMP                                                      ->7
          6    >   QM_ASSIGN                                        ~3      'no+message'
          7    > > RETURN                                                   ~3
   19     8*     > RETURN                                                   null

End of function get_message_ternary

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.07 ms | 1403 KiB | 16 Q