3v4l.org

run code in 300+ PHP versions simultaneously
<?php $users = [ "4" => "John", "7" => "Alex", "13" => "Smith", "95" => "Taylor" ]; $id = 9; $nearestUserByIdInReverseOrder = false; foreach($users as $userId => $name) { if($id >= $userId) { $nearestUserByIdInReverseOrder = $name; } } echo $nearestUserByIdInReverseOrder;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 9
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/OelF2
function name:  (null)
number of ops:  13
compiled vars:  !0 = $users, !1 = $id, !2 = $nearestUserByIdInReverseOrder, !3 = $name, !4 = $userId
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        ASSIGN                                                   !1, 9
   12     2        ASSIGN                                                   !2, <false>
   14     3      > FE_RESET_R                                       $8      !0, ->10
          4    > > FE_FETCH_R                                       ~9      $8, !3, ->10
          5    >   ASSIGN                                                   !4, ~9
   15     6        IS_SMALLER_OR_EQUAL                                      !4, !1
          7      > JMPZ                                                     ~11, ->9
   16     8    >   ASSIGN                                                   !2, !3
   14     9    > > JMP                                                      ->4
         10    >   FE_FREE                                                  $8
   20    11        ECHO                                                     !2
   21    12      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.52 ms | 996 KiB | 13 Q