3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'Adolf', 'Doe', 'adept', 'Done', 'dear', 'adopt', 'Deer' ]; $startsWith = 'do'; usort( $array, fn($a, $b) => (stripos($a, $startsWith) !== 0) <=> (stripos($b, $startsWith) !== 0) ?: strcasecmp($a, $b) ); var_export($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Stcgc
function name:  (null)
number of ops:  12
compiled vars:  !0 = $array, !1 = $startsWith
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   13     1        ASSIGN                                                   !1, 'do'
   15     2        INIT_FCALL                                               'usort'
   16     3        SEND_REF                                                 !0
   17     4        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          5        BIND_LEXICAL                                             ~4, !1
   20     6        SEND_VAL                                                 ~4
   15     7        DO_ICALL                                                 
   21     8        INIT_FCALL                                               'var_export'
          9        SEND_VAR                                                 !0
         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/Stcgc
function name:  {closure}
number of ops:  22
compiled vars:  !0 = $a, !1 = $b, !2 = $startsWith
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   18     3        INIT_FCALL                                               'stripos'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !2
          6        DO_ICALL                                         $3      
          7        IS_NOT_IDENTICAL                                 ~4      $3, 0
          8        INIT_FCALL                                               'stripos'
          9        SEND_VAR                                                 !1
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                         $5      
         12        IS_NOT_IDENTICAL                                 ~6      $5, 0
         13        SPACESHIP                                        ~7      ~4, ~6
         14        JMP_SET                                          ~8      ~7, ->20
   19    15        INIT_FCALL                                               'strcasecmp'
         16        SEND_VAR                                                 !0
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                         $9      
         19        QM_ASSIGN                                        ~8      $9
         20      > RETURN                                                   ~8
   20    21*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
276.96 ms | 1017 KiB | 17 Q