3v4l.org

run code in 500+ PHP versions simultaneously
<?php function _rsort(&$data, $mode) { rsort($data, $mode); return $data; } $data = [1,5,19,3,67,8,9,45,6,2,18,24,58,63,12,10]; $result = array_filter( array: $data, callback: fn($item) => !in_array($item, array_slice(_rsort($data, SORT_NUMERIC), 0, 10)) ); print_r($result); $data = [1,5,19,3,67,8,9,45,6,2,18,24,58,63,12,10]; $top_10 = array_slice(_rsort($data, SORT_NUMERIC), 0, 10); $result = array_filter( array: $data, callback: fn($item) => !in_array($item, $top_10) ); print_r($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9Nieo
function name:  (null)
number of ops:  33
compiled vars:  !0 = $data, !1 = $result, !2 = $top_10
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                       !0, <array>
    7     1        INIT_FCALL                                                   'array_filter'
    8     2        SEND_VAR                                                     !0
    9     3        DECLARE_LAMBDA_FUNCTION                              ~4      [0]
          4        BIND_LEXICAL                                                 ~4, !0
   10     5        SEND_VAL                                                     ~4
    7     6        DO_ICALL                                             $5      
          7        ASSIGN                                                       !1, $5
   11     8        INIT_FCALL                                                   'print_r'
          9        SEND_VAR                                                     !1
         10        DO_ICALL                                                     
   13    11        ASSIGN                                                       !0, <array>
   15    12        INIT_FCALL                                                   'array_slice'
         13        INIT_FCALL                                                   '_rsort'
         14        SEND_REF                                                     !0
         15        SEND_VAL                                                     1
         16        DO_FCALL                                          0  $9      
         17        SEND_VAR                                                     $9
         18        SEND_VAL                                                     0
         19        SEND_VAL                                                     10
         20        DO_ICALL                                             $10     
         21        ASSIGN                                                       !2, $10
   16    22        INIT_FCALL                                                   'array_filter'
   17    23        SEND_VAR                                                     !0
   18    24        DECLARE_LAMBDA_FUNCTION                              ~12     [1]
         25        BIND_LEXICAL                                                 ~12, !2
   19    26        SEND_VAL                                                     ~12
   16    27        DO_ICALL                                             $13     
         28        ASSIGN                                                       !1, $13
   20    29        INIT_FCALL                                                   'print_r'
         30        SEND_VAR                                                     !1
         31        DO_ICALL                                                     
         32      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9Nieo
function name:  {closure:/in/9Nieo:9}
number of ops:  15
compiled vars:  !0 = $item, !1 = $data
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   RECV                                                 !0      
          1        BIND_STATIC                                                  !1
          2        INIT_FCALL                                                   'array_slice'
          3        INIT_FCALL                                                   '_rsort'
          4        SEND_REF                                                     !1
          5        SEND_VAL                                                     1
          6        DO_FCALL                                          0  $2      
          7        SEND_VAR                                                     $2
          8        SEND_VAL                                                     0
          9        SEND_VAL                                                     10
         10        DO_ICALL                                             $3      
         11        FRAMELESS_ICALL_2                in_array            ~4      !0, $3
         12        BOOL_NOT                                             ~5      ~4
         13      > RETURN                                                       ~5
   10    14*     > RETURN                                                       null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9Nieo
function name:  {closure:/in/9Nieo:18}
number of ops:  6
compiled vars:  !0 = $item, !1 = $top_10
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   18     0  E >   RECV                                                 !0      
          1        BIND_STATIC                                                  !1
          2        FRAMELESS_ICALL_2                in_array            ~2      !0, !1
          3        BOOL_NOT                                             ~3      ~2
          4      > RETURN                                                       ~3
   19     5*     > RETURN                                                       null

End of Dynamic Function 1

Function _rsort:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9Nieo
function name:  _rsort
number of ops:  8
compiled vars:  !0 = $data, !1 = $mode
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        INIT_FCALL                                                   'rsort'
          3        SEND_REF                                                     !0
          4        SEND_VAR                                                     !1
          5        DO_ICALL                                                     
          6      > RETURN                                                       !0
          7*     > RETURN                                                       null

End of function _rsort

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
162 ms | 1614 KiB | 21 Q