3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace std { function array_shift(array &$array): mixed { foreach ($array as $key => $item) { unset($array[$key]); return $item; } return null; } } namespace { $preflight = microtime(true); $foo = ['bar', 123, 'baz', true]; $start = microtime(true); var_dump(array_shift($foo), $foo); $end = microtime(true); printf("%0.6fs\n", $end - $start); $foo = ['bar', 123, 'baz', true]; $start = microtime(true); var_dump(std\array_shift($foo), $foo); $end = microtime(true); printf("%0.6fs\n", $end - $start); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7pONv
function name:  (null)
number of ops:  47
compiled vars:  !0 = $preflight, !1 = $foo, !2 = $start, !3 = $end
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'microtime'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                         $4      
          3        ASSIGN                                                   !0, $4
   15     4        ASSIGN                                                   !1, <array>
   16     5        INIT_FCALL                                               'microtime'
          6        SEND_VAL                                                 <true>
          7        DO_ICALL                                         $7      
          8        ASSIGN                                                   !2, $7
   17     9        INIT_FCALL                                               'var_dump'
         10        INIT_FCALL                                               'array_shift'
         11        SEND_REF                                                 !1
         12        DO_ICALL                                         $9      
         13        SEND_VAR                                                 $9
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                                 
   18    16        INIT_FCALL                                               'microtime'
         17        SEND_VAL                                                 <true>
         18        DO_ICALL                                         $11     
         19        ASSIGN                                                   !3, $11
   19    20        INIT_FCALL                                               'printf'
         21        SEND_VAL                                                 '%250.6fs%0A'
         22        SUB                                              ~13     !3, !2
         23        SEND_VAL                                                 ~13
         24        DO_ICALL                                                 
   20    25        ASSIGN                                                   !1, <array>
   21    26        INIT_FCALL                                               'microtime'
         27        SEND_VAL                                                 <true>
         28        DO_ICALL                                         $16     
         29        ASSIGN                                                   !2, $16
   22    30        INIT_FCALL                                               'var_dump'
         31        INIT_FCALL                                               'std%5Carray_shift'
         32        SEND_REF                                                 !1
         33        DO_FCALL                                      0  $18     
         34        SEND_VAR                                                 $18
         35        SEND_VAR                                                 !1
         36        DO_ICALL                                                 
   23    37        INIT_FCALL                                               'microtime'
         38        SEND_VAL                                                 <true>
         39        DO_ICALL                                         $20     
         40        ASSIGN                                                   !3, $20
   24    41        INIT_FCALL                                               'printf'
         42        SEND_VAL                                                 '%250.6fs%0A'
         43        SUB                                              ~22     !3, !2
         44        SEND_VAL                                                 ~22
         45        DO_ICALL                                                 
   25    46      > RETURN                                                   1

Function std%5Carray_shift:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 8
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/7pONv
function name:  std\array_shift
number of ops:  12
compiled vars:  !0 = $array, !1 = $item, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1      > FE_RESET_R                                       $3      !0, ->8
          2    > > FE_FETCH_R                                       ~4      $3, !1, ->8
          3    >   ASSIGN                                                   !2, ~4
    6     4        UNSET_DIM                                                !0, !2
    7     5        FE_FREE                                                  $3
          6      > RETURN                                                   !1
    5     7*       JMP                                                      ->2
          8    >   FE_FREE                                                  $3
   10     9      > RETURN                                                   null
   11    10*       VERIFY_RETURN_TYPE                                       
         11*     > RETURN                                                   null

End of function std%5Carray_shift

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
127.78 ms | 1407 KiB | 22 Q