3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ null, null, null, 1, null ]; function getFirstNull($array) { return array_shift($array) ?? ($array ? getFirstNull($array) : null); } var_export(getFirstNull($array));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/W511X
function name:  (null)
number of ops:  8
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   14     1        INIT_FCALL                                               'var_export'
          2        INIT_FCALL                                               'getfirstnull'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function getfirstnull:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/W511X
function name:  getFirstNull
number of ops:  15
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        INIT_FCALL                                               'array_shift'
          2        SEND_REF                                                 !0
          3        DO_ICALL                                         $1      
          4        COALESCE                                         ~2      $1
          5      > JMPZ                                                     !0, ->11
          6    >   INIT_FCALL_BY_NAME                                       'getFirstNull'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0  $3      
          9        QM_ASSIGN                                        ~4      $3
         10      > JMP                                                      ->12
         11    >   QM_ASSIGN                                        ~4      null
         12    >   QM_ASSIGN                                        ~2      ~4
         13      > RETURN                                                   ~2
   13    14*     > RETURN                                                   null

End of function getfirstnull

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.92 ms | 1014 KiB | 16 Q