3v4l.org

run code in 300+ PHP versions simultaneously
<?php $w = date("w"); $array = array( 0 => 1, 1 => 2, 2 => 3, 3 => 4, 4 => 5 ); function find(array $array, $needle) { $last = null; // return value if $pricing array is empty foreach ($array as $key => $value) { if ($key >= $needle) { return $value; } $last = $key; } return $last; } if(in_array($w, $array)) { echo find($array, $w); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/4pYGP
function name:  (null)
number of ops:  16
compiled vars:  !0 = $w, !1 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'date'
          1        SEND_VAL                                                 'w'
          2        DO_ICALL                                         $2      
          3        ASSIGN                                                   !0, $2
    3     4        ASSIGN                                                   !1, <array>
   17     5        INIT_FCALL                                               'in_array'
          6        SEND_VAR                                                 !0
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $5      
          9      > JMPZ                                                     $5, ->15
   18    10    >   INIT_FCALL                                               'find'
         11        SEND_VAR                                                 !1
         12        SEND_VAR                                                 !0
         13        DO_FCALL                                      0  $6      
         14        ECHO                                                     $6
   19    15    > > RETURN                                                   1

Function find:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 12
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 12
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/4pYGP
function name:  find
number of ops:  15
compiled vars:  !0 = $array, !1 = $needle, !2 = $last, !3 = $value, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        ASSIGN                                                   !2, null
    8     3      > FE_RESET_R                                       $6      !0, ->12
          4    > > FE_FETCH_R                                       ~7      $6, !3, ->12
          5    >   ASSIGN                                                   !4, ~7
    9     6        IS_SMALLER_OR_EQUAL                                      !1, !4
          7      > JMPZ                                                     ~9, ->10
   10     8    >   FE_FREE                                                  $6
          9      > RETURN                                                   !3
   12    10    >   ASSIGN                                                   !2, !4
    8    11      > JMP                                                      ->4
         12    >   FE_FREE                                                  $6
   14    13      > RETURN                                                   !2
   15    14*     > RETURN                                                   null

End of function find

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.41 ms | 1399 KiB | 18 Q