3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 1 => 'admin', '5d1acff7-51f5-d10a-8807-5ce3a25f3f01' => 'atul', '9324e078-e651-09ab-856c-5d00cf1d6302' => 'tushar', '3e4d9711-e4e0-f9de-8d40-5d021f3137fb' => 'praful', 'b283b589-c527-389f-498b-5cf0ea2338e1' => 'suraj' ]; $values = array_values($array); $offset = array_search('atul', $values); if ($offset !== false && isset($values[++$offset])) { $element = array_slice($array, $offset, 1, true); echo key($element) , " : " , current($element); } else { echo "not found or no next"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 12, Position 2 = 15
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 33
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/cmPpB
function name:  (null)
number of ops:  35
compiled vars:  !0 = $array, !1 = $values, !2 = $offset, !3 = $element
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   11     1        INIT_FCALL                                               'array_values'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $5      
          4        ASSIGN                                                   !1, $5
   12     5        INIT_FCALL                                               'array_search'
          6        SEND_VAL                                                 'atul'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $7      
          9        ASSIGN                                                   !2, $7
   14    10        TYPE_CHECK                                  1018  ~9      !2
         11      > JMPZ_EX                                          ~9      ~9, ->15
         12    >   PRE_INC                                          ~10     !2
         13        ISSET_ISEMPTY_DIM_OBJ                         0  ~11     !1, ~10
         14        BOOL                                             ~9      ~11
         15    > > JMPZ                                                     ~9, ->33
   15    16    >   INIT_FCALL                                               'array_slice'
         17        SEND_VAR                                                 !0
         18        SEND_VAR                                                 !2
         19        SEND_VAL                                                 1
         20        SEND_VAL                                                 <true>
         21        DO_ICALL                                         $12     
         22        ASSIGN                                                   !3, $12
   16    23        INIT_FCALL                                               'key'
         24        SEND_VAR                                                 !3
         25        DO_ICALL                                         $14     
         26        ECHO                                                     $14
         27        ECHO                                                     '+%3A+'
         28        INIT_FCALL                                               'current'
         29        SEND_VAR                                                 !3
         30        DO_ICALL                                         $15     
         31        ECHO                                                     $15
         32      > JMP                                                      ->34
   18    33    >   ECHO                                                     'not+found+or+no+next'
   19    34    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.88 ms | 1396 KiB | 23 Q