3v4l.org

run code in 300+ PHP versions simultaneously
<?php $newarray = array('489289', '536516', '332833', '536516'); $rockin = array( '489289' => array('536516','value1'), '332833' => array('536516'), ); foreach ($rockin as $array) { foreach ($array as $value) { if (in_array($value, $newarray)) { $key = array_search($value, $array); var_dump($key); $newarray = array_diff($newarray, array($key)); break; } } } var_dump($newarray);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 29
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 29
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 27
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 27
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 26
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 27
Branch analysis from position: 27
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/lkWdc
function name:  (null)
number of ops:  34
compiled vars:  !0 = $newarray, !1 = $rockin, !2 = $array, !3 = $value, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, <array>
   10     2      > FE_RESET_R                                       $7      !1, ->29
          3    > > FE_FETCH_R                                               $7, !2, ->29
   11     4    > > FE_RESET_R                                       $8      !2, ->27
          5    > > FE_FETCH_R                                               $8, !3, ->27
   12     6    >   INIT_FCALL                                               'in_array'
          7        SEND_VAR                                                 !3
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $9      
         10      > JMPZ                                                     $9, ->26
   13    11    >   INIT_FCALL                                               'array_search'
         12        SEND_VAR                                                 !3
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                         $10     
         15        ASSIGN                                                   !4, $10
   14    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !4
         18        DO_ICALL                                                 
   15    19        INIT_FCALL                                               'array_diff'
         20        SEND_VAR                                                 !0
         21        INIT_ARRAY                                       ~13     !4
         22        SEND_VAL                                                 ~13
         23        DO_ICALL                                         $14     
         24        ASSIGN                                                   !0, $14
   16    25      > JMP                                                      ->27
   11    26    > > JMP                                                      ->5
         27    >   FE_FREE                                                  $8
   10    28      > JMP                                                      ->3
         29    >   FE_FREE                                                  $7
   21    30        INIT_FCALL                                               'var_dump'
         31        SEND_VAR                                                 !0
         32        DO_ICALL                                                 
         33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.58 ms | 1401 KiB | 21 Q