3v4l.org

run code in 300+ PHP versions simultaneously
<?php $userdb = array( array( 'uid' => '100', 'name' => 'Sandra Shush', 'pic_square' => 'urlof100' ), array( 'uid' => '5465', 'name' => 'Stefanie Mcmohn', 'pic_square' => 'urlof100' ), array( 'uid' => '40489', 'name' => 'Michael', 'pic_square' => 'urlof40489' ) ); function find_user($userdb, $attributes) { foreach ($userdb as $key => $user) { if (empty(array_diff($attributes, $user))) return $key; } return false; } echo find_user($userdb, array('name' => 'Stefanie Mcmohn', 'uid' => 5465));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aOTbq
function name:  (null)
number of ops:  7
compiled vars:  !0 = $userdb
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   28     1        INIT_FCALL                                               'find_user'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <array>
          4        DO_FCALL                                      0  $2      
          5        ECHO                                                     $2
          6      > RETURN                                                   1

Function find_user:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 14
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 14
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/aOTbq
function name:  find_user
number of ops:  17
compiled vars:  !0 = $userdb, !1 = $attributes, !2 = $user, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   22     2      > FE_RESET_R                                       $4      !0, ->14
          3    > > FE_FETCH_R                                       ~5      $4, !2, ->14
          4    >   ASSIGN                                                   !3, ~5
   23     5        INIT_FCALL                                               'array_diff'
          6        SEND_VAR                                                 !1
          7        SEND_VAR                                                 !2
          8        DO_ICALL                                         $7      
          9        BOOL_NOT                                         ~8      $7
         10      > JMPZ                                                     ~8, ->13
         11    >   FE_FREE                                                  $4
         12      > RETURN                                                   !3
   22    13    > > JMP                                                      ->3
         14    >   FE_FREE                                                  $4
   25    15      > RETURN                                                   <false>
   26    16*     > RETURN                                                   null

End of function find_user

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.16 ms | 1003 KiB | 15 Q