3v4l.org

run code in 300+ PHP versions simultaneously
<?php $books_sorted=array( 0 => array( "title" => "In Search of Lost Time" ), 1 => array( "title" => "Don Quixote" ), 2 => array( "title" => "The Great Gatsby" ) ); $books_available=array( 0 => array( "title" => "Moby Dick" ), 1 => array( "title" => "In Search of Lost Time" ), 2 => array( "title" => "The Great Gatsby" ), 3 => array( "title" => "War and Peace" ) ); $books_sorted_titles = array_column($books_sorted, 'title'); usort($books_available, function($k, $v) use ($books_sorted_titles) { return in_array($v['title'], $books_sorted_titles) ? 1 : -1; }); print_r($books_available);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NsPtf
function name:  (null)
number of ops:  17
compiled vars:  !0 = $books_sorted, !1 = $books_available, !2 = $books_sorted_titles
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   15     1        ASSIGN                                                   !1, <array>
   30     2        INIT_FCALL                                               'array_column'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'title'
          5        DO_ICALL                                         $5      
          6        ASSIGN                                                   !2, $5
   31     7        INIT_FCALL                                               'usort'
          8        SEND_REF                                                 !1
          9        DECLARE_LAMBDA_FUNCTION                          ~7      [0]
         10        BIND_LEXICAL                                             ~7, !2
   33    11        SEND_VAL                                                 ~7
   31    12        DO_ICALL                                                 
   35    13        INIT_FCALL                                               'print_r'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                                 
         16      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NsPtf
function name:  {closure}
number of ops:  14
compiled vars:  !0 = $k, !1 = $v, !2 = $books_sorted_titles
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   32     3        INIT_FCALL                                               'in_array'
          4        FETCH_DIM_R                                      ~3      !1, 'title'
          5        SEND_VAL                                                 ~3
          6        SEND_VAR                                                 !2
          7        DO_ICALL                                         $4      
          8      > JMPZ                                                     $4, ->11
          9    >   QM_ASSIGN                                        ~5      1
         10      > JMP                                                      ->12
         11    >   QM_ASSIGN                                        ~5      -1
         12    > > RETURN                                                   ~5
   33    13*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.67 ms | 1014 KiB | 17 Q