3v4l.org

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

Function array_fetch:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SL5cG
function name:  array_fetch
number of ops:  10
compiled vars:  !0 = $a, !1 = $element
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'current'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        ASSIGN                                                   !1, $2
    7     5        INIT_FCALL                                               'next'
          6        SEND_REF                                                 !0
          7        DO_ICALL                                                 
    8     8      > RETURN                                                   !1
    9     9*     > RETURN                                                   null

End of function array_fetch

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.83 ms | 1389 KiB | 20 Q