3v4l.org

run code in 500+ PHP versions simultaneously
<?php $str = "Hello World January Jude"; $arr = ["Hello World January Jude Lol Love","Hello Lol Loop","Love Life Jude","Crude Flash Hello"]; usort($arr, function ($a, $b) use ($str) { $aa = count(array_intersect(explode(" ", $str), explode(" ", $a))); $bb = count(array_intersect(explode(" ", $str), explode(" ", $b))); return $bb - $aa; }); print_r($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4SPHu
function name:  (null)
number of ops:  12
compiled vars:  !0 = $str, !1 = $arr
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'Hello+World+January+Jude'
    4     1        ASSIGN                                                       !1, <array>
    6     2        INIT_FCALL                                                   'usort'
          3        SEND_REF                                                     !1
          4        DECLARE_LAMBDA_FUNCTION                              ~4      [0]
          5        BIND_LEXICAL                                                 ~4, !0
   10     6        SEND_VAL                                                     ~4
    6     7        DO_ICALL                                                     
   11     8        INIT_FCALL                                                   'print_r'
          9        SEND_VAR                                                     !1
         10        DO_ICALL                                                     
         11      > 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/4SPHu
function name:  {closure:/in/4SPHu:6}
number of ops:  34
compiled vars:  !0 = $a, !1 = $b, !2 = $str, !3 = $aa, !4 = $bb
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        BIND_STATIC                                                  !2
    7     3        INIT_FCALL                                                   'array_intersect'
          4        INIT_FCALL                                                   'explode'
          5        SEND_VAL                                                     '+'
          6        SEND_VAR                                                     !2
          7        DO_ICALL                                             $5      
          8        SEND_VAR                                                     $5
          9        INIT_FCALL                                                   'explode'
         10        SEND_VAL                                                     '+'
         11        SEND_VAR                                                     !0
         12        DO_ICALL                                             $6      
         13        SEND_VAR                                                     $6
         14        DO_ICALL                                             $7      
         15        COUNT                                                ~8      $7
         16        ASSIGN                                                       !3, ~8
    8    17        INIT_FCALL                                                   'array_intersect'
         18        INIT_FCALL                                                   'explode'
         19        SEND_VAL                                                     '+'
         20        SEND_VAR                                                     !2
         21        DO_ICALL                                             $10     
         22        SEND_VAR                                                     $10
         23        INIT_FCALL                                                   'explode'
         24        SEND_VAL                                                     '+'
         25        SEND_VAR                                                     !1
         26        DO_ICALL                                             $11     
         27        SEND_VAR                                                     $11
         28        DO_ICALL                                             $12     
         29        COUNT                                                ~13     $12
         30        ASSIGN                                                       !4, ~13
    9    31        SUB                                                  ~15     !4, !3
         32      > RETURN                                                       ~15
   10    33*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
164.69 ms | 2179 KiB | 17 Q