3v4l.org

run code in 300+ PHP versions simultaneously
<?php $names = array("John","Doe","Polo","Marco","Smith"); $array = array(); for($i = 0; $i < 20; $i ++) { $key = mt_rand(0, 1000); $array[$key]["firstName"] = $names[array_rand($names)]; $array[$key]["lastName"] = $names[array_rand($names)]; } // Start Sorting process ksort($array); // Start Storage $data = $hash = array(); // Loop and porpulate new array foreach ( $array as $k => $v ) { $h = sha1($v['firstName'] . $v["lastName"]); isset($hash[$h]) or $data[$k] = $v and $hash[$h] = 1; } var_dump($data);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 4
Branch analysis from position: 26
2 jumps found. (Code = 77) Position 1 = 32, Position 2 = 51
Branch analysis from position: 32
2 jumps found. (Code = 78) Position 1 = 33, Position 2 = 51
Branch analysis from position: 33
2 jumps found. (Code = 47) Position 1 = 43, Position 2 = 50
Branch analysis from position: 43
2 jumps found. (Code = 46) Position 1 = 46, Position 2 = 49
Branch analysis from position: 46
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
Branch analysis from position: 49
Branch analysis from position: 50
Branch analysis from position: 51
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 51
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 4
Branch analysis from position: 26
Branch analysis from position: 4
filename:       /in/DCiqI
function name:  (null)
number of ops:  56
compiled vars:  !0 = $names, !1 = $array, !2 = $i, !3 = $key, !4 = $data, !5 = $hash, !6 = $v, !7 = $k, !8 = $h
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    6     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->24
    7     4    >   INIT_FCALL                                               'mt_rand'
          5        SEND_VAL                                                 0
          6        SEND_VAL                                                 1000
          7        DO_ICALL                                         $12     
          8        ASSIGN                                                   !3, $12
    8     9        INIT_FCALL                                               'array_rand'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $16     
         12        FETCH_DIM_R                                      ~17     !0, $16
         13        FETCH_DIM_W                                      $14     !1, !3
         14        ASSIGN_DIM                                               $14, 'firstName'
         15        OP_DATA                                                  ~17
    9    16        INIT_FCALL                                               'array_rand'
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                         $20     
         19        FETCH_DIM_R                                      ~21     !0, $20
         20        FETCH_DIM_W                                      $18     !1, !3
         21        ASSIGN_DIM                                               $18, 'lastName'
         22        OP_DATA                                                  ~21
    6    23        PRE_INC                                                  !2
         24    >   IS_SMALLER                                               !2, 20
         25      > JMPNZ                                                    ~23, ->4
   13    26    >   INIT_FCALL                                               'ksort'
         27        SEND_REF                                                 !1
         28        DO_ICALL                                                 
   16    29        ASSIGN                                           ~25     !5, <array>
         30        ASSIGN                                                   !4, ~25
   19    31      > FE_RESET_R                                       $27     !1, ->51
         32    > > FE_FETCH_R                                       ~28     $27, !6, ->51
         33    >   ASSIGN                                                   !7, ~28
   20    34        INIT_FCALL                                               'sha1'
         35        FETCH_DIM_R                                      ~30     !6, 'firstName'
         36        FETCH_DIM_R                                      ~31     !6, 'lastName'
         37        CONCAT                                           ~32     ~30, ~31
         38        SEND_VAL                                                 ~32
         39        DO_ICALL                                         $33     
         40        ASSIGN                                                   !8, $33
   21    41        ISSET_ISEMPTY_DIM_OBJ                         0  ~35     !5, !8
         42      > JMPNZ_EX                                         ~35     ~35, ->50
         43    >   ASSIGN_DIM                                       ~36     !4, !7
         44        OP_DATA                                                  !6
         45      > JMPZ_EX                                          ~36     ~36, ->49
         46    >   ASSIGN_DIM                                       ~37     !5, !8
         47        OP_DATA                                                  1
         48        BOOL                                             ~36     ~37
         49    >   BOOL                                             ~35     ~36
   19    50    > > JMP                                                      ->32
         51    >   FE_FREE                                                  $27
   24    52        INIT_FCALL                                               'var_dump'
         53        SEND_VAR                                                 !4
         54        DO_ICALL                                                 
         55      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.63 ms | 1400 KiB | 23 Q