3v4l.org

run code in 300+ PHP versions simultaneously
<?php function coalesce($default, &...$args) { foreach ($args as &$arg) { if ($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/qFgMW
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 = 125) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
2 jumps found. (Code = 126) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/qFgMW
function name:  coalesce
number of ops:  11
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_RW                                      $3      !1, ->8
          3    > > FE_FETCH_RW                                              $3, !2, ->8
    6     4    > > JMPZ                                                     !2, ->7
    7     5    >   FE_FREE                                                  $3
          6      > RETURN                                                   !2
    5     7    > > JMP                                                      ->3
          8    >   FE_FREE                                                  $3
   11     9      > RETURN                                                   !0
   12    10*     > RETURN                                                   null

End of function coalesce

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.59 ms | 1398 KiB | 14 Q