3v4l.org

run code in 300+ PHP versions simultaneously
<?php function coalesce($default, &...$args) { foreach ($args as $arg) { if (!empty($arg)) { return $arg; } } return $default; } $e1 = []; $e2 = ''; echo coalesce('default', $e1, $happy, $e2);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3H49Q
function name:  (null)
number of ops:  10
compiled vars:  !0 = $e1, !1 = $e2, !2 = $happy
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ASSIGN                                                   !0, <array>
   15     1        ASSIGN                                                   !1, ''
   16     2        INIT_FCALL                                               'coalesce'
          3        SEND_VAL                                                 'default'
          4        SEND_REF                                                 !0
          5        SEND_REF                                                 !2
          6        SEND_REF                                                 !1
          7        DO_FCALL                                      0  $5      
          8        ECHO                                                     $5
          9      > RETURN                                                   1

Function coalesce:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/3H49Q
function name:  coalesce
number of ops:  13
compiled vars:  !0 = $default, !1 = $args, !2 = $arg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV_VARIADIC                                    !1      
    5     2      > FE_RESET_R                                       $3      !1, ->10
          3    > > FE_FETCH_R                                               $3, !2, ->10
    6     4    >   ISSET_ISEMPTY_CV                                 ~4      !2
          5        BOOL_NOT                                         ~5      ~4
          6      > JMPZ                                                     ~5, ->9
    7     7    >   FE_FREE                                                  $3
          8      > RETURN                                                   !2
    5     9    > > JMP                                                      ->3
         10    >   FE_FREE                                                  $3
   11    11      > RETURN                                                   !0
   12    12*     > RETURN                                                   null

End of function coalesce

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.05 ms | 944 KiB | 15 Q