3v4l.org

run code in 500+ PHP versions simultaneously
<?php // Yes we can use special chars in identifiers! class ñßü {} $chars = ['aa', 'az', 'b', 'c', 'x', 'za', 'ä', 'ü', 'ß', 'ñ']; // Put the lowercase chars twice to identify if they have equal weight. $chars = [...$chars, ...array_map(ucfirst(...), $chars), ...$chars]; foreach ([ 'usort + strcmp' => fn (&$arr) => usort($arr, strcmp(...)), 'usort + strcasecmp' => fn (&$arr) => usort($arr, strcasecmp(...)), 'sort' => sort(...), ] as $name => $sortfunction) { $chars_sorted = $chars; $sortfunction($chars_sorted); print implode(', ', $chars_sorted) . " # $name\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 33
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 33
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
filename:       /in/iUKZh
function name:  (null)
number of ops:  35
compiled vars:  !0 = $chars, !1 = $sortfunction, !2 = $name, !3 = $chars_sorted
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   ASSIGN                                                       !0, <array>
    8     1        INIT_ARRAY                                           ~5      
          2        ADD_ARRAY_UNPACK                                     ~5      !0
          3        INIT_FCALL                                                   'array_map'
          4        INIT_FCALL                                                   'ucfirst'
          5        CALLABLE_CONVERT                                     ~6      
          6        SEND_VAL                                                     ~6
          7        SEND_VAR                                                     !0
          8        DO_ICALL                                             $7      
          9        ADD_ARRAY_UNPACK                                     ~5      $7
         10        ADD_ARRAY_UNPACK                                     ~5      !0
         11        ASSIGN                                                       !0, ~5
   12    12        DECLARE_LAMBDA_FUNCTION                              ~9      [0]
         13        INIT_ARRAY                                           ~10     ~9, 'usort+%2B+strcmp'
   13    14        DECLARE_LAMBDA_FUNCTION                              ~11     [1]
         15        ADD_ARRAY_ELEMENT                                    ~10     ~11, 'usort+%2B+strcasecmp'
   14    16        INIT_FCALL                                                   'sort'
         17        CALLABLE_CONVERT                                     ~12     
         18        ADD_ARRAY_ELEMENT                                    ~10     ~12, 'sort'
         19      > FE_RESET_R                                           $13     ~10, ->33
         20    > > FE_FETCH_R                                           ~14     $13, !1, ->33
   15    21    >   ASSIGN                                                       !2, ~14
   16    22        ASSIGN                                                       !3, !0
   17    23        INIT_DYNAMIC_CALL                                            !1
         24        SEND_VAR_EX                                                  !3
         25        DO_FCALL                                          0          
   18    26        FRAMELESS_ICALL_2                implode             ~18     '%2C+', !3
         27        ROPE_INIT                                         3  ~20     '++%23+'
         28        ROPE_ADD                                          1  ~20     ~20, !2
         29        ROPE_END                                          2  ~19     ~20, '%0A'
         30        CONCAT                                               ~22     ~18, ~19
         31        ECHO                                                         ~22
   12    32      > JMP                                                          ->20
         33    >   FE_FREE                                                      $13
   19    34      > 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/iUKZh
function name:  {closure:/in/iUKZh:12}
number of ops:  9
compiled vars:  !0 = $arr
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   RECV                                                 !0      
          1        INIT_FCALL                                                   'usort'
          2        SEND_REF                                                     !0
          3        INIT_FCALL                                                   'strcmp'
          4        CALLABLE_CONVERT                                     ~1      
          5        SEND_VAL                                                     ~1
          6        DO_ICALL                                             $2      
          7      > RETURN                                                       $2
          8*     > 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/iUKZh
function name:  {closure:/in/iUKZh:13}
number of ops:  9
compiled vars:  !0 = $arr
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   RECV                                                 !0      
          1        INIT_FCALL                                                   'usort'
          2        SEND_REF                                                     !0
          3        INIT_FCALL                                                   'strcasecmp'
          4        CALLABLE_CONVERT                                     ~1      
          5        SEND_VAL                                                     ~1
          6        DO_ICALL                                             $2      
          7      > RETURN                                                       $2
          8*     > RETURN                                                       null

End of Dynamic Function 1

Class ñßü: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
176.88 ms | 1639 KiB | 19 Q