3v4l.org

run code in 500+ PHP versions simultaneously
<?php $testStrings = [ "H3||0", "Hallo", "aloha", "h", "hallo", "hallå", "hel", "helicopter", "hellacious", "hello", "hello y'all", "hello yall", "helów", "hey hello", "hola", "hêllo", "mellow yellow", "try", ]; $needle = 'hello'; usort($testStrings, fn($a, $b) => [is_int(similar_text($needle, $b, $percentB)), $percentB] <=> [is_int(similar_text($needle, $a, $percentA)), $percentA] ); var_export($testStrings);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9YNAI
function name:  (null)
number of ops:  14
compiled vars:  !0 = $testStrings, !1 = $needle, !2 = $percentB, !3 = $percentA
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   24     1        ASSIGN                                                       !1, 'hello'
   26     2        INIT_FCALL                                                   'usort'
          3        SEND_REF                                                     !0
          4        DECLARE_LAMBDA_FUNCTION                              ~6      [0]
          5        BIND_LEXICAL                                                 ~6, !1
          6        BIND_LEXICAL                                                 ~6, !2
          7        BIND_LEXICAL                                                 ~6, !3
   30     8        SEND_VAL                                                     ~6
   26     9        DO_ICALL                                                     
   31    10        INIT_FCALL                                                   'var_export'
         11        SEND_VAR                                                     !0
         12        DO_ICALL                                                     
         13      > 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/9YNAI
function name:  {closure:/in/9YNAI:26}
number of ops:  24
compiled vars:  !0 = $a, !1 = $b, !2 = $needle, !3 = $percentB, !4 = $percentA
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   26     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        BIND_STATIC                                                  !2
          3        BIND_STATIC                                                  !3
          4        BIND_STATIC                                                  !4
   27     5        INIT_FCALL                                                   'similar_text'
          6        SEND_VAR                                                     !2
          7        SEND_VAR                                                     !1
          8        SEND_REF                                                     !3
          9        DO_ICALL                                             $5      
         10        TYPE_CHECK                                       16  ~6      $5
         11        INIT_ARRAY                                           ~7      ~6
         12        ADD_ARRAY_ELEMENT                                    ~7      !3
   29    13        INIT_FCALL                                                   'similar_text'
         14        SEND_VAR                                                     !2
         15        SEND_VAR                                                     !0
         16        SEND_REF                                                     !4
         17        DO_ICALL                                             $8      
         18        TYPE_CHECK                                       16  ~9      $8
         19        INIT_ARRAY                                           ~10     ~9
         20        ADD_ARRAY_ELEMENT                                    ~10     !4
         21        SPACESHIP                                            ~11     ~7, ~10
         22      > RETURN                                                       ~11
   30    23*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
161.1 ms | 2208 KiB | 16 Q