3v4l.org

run code in 300+ 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 = 36
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 36
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
filename:       /in/iUKZh
function name:  (null)
number of ops:  38
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        ZEND_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        ZEND_CALLABLE_CONVERT                            ~12     
         18        ADD_ARRAY_ELEMENT                                ~10     ~12, 'sort'
         19      > FE_RESET_R                                       $13     ~10, ->36
         20    > > FE_FETCH_R                                       ~14     $13, !1, ->36
   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        INIT_FCALL                                               'implode'
         27        SEND_VAL                                                 '%2C+'
         28        SEND_VAR                                                 !3
         29        DO_ICALL                                         $18     
         30        ROPE_INIT                                     3  ~20     '++%23+'
         31        ROPE_ADD                                      1  ~20     ~20, !2
         32        ROPE_END                                      2  ~19     ~20, '%0A'
         33        CONCAT                                           ~22     $18, ~19
         34        ECHO                                                     ~22
   12    35      > JMP                                                      ->20
         36    >   FE_FREE                                                  $13
   19    37      > 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}
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        ZEND_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}
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        ZEND_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.0.0


preferences:
130.55 ms | 1462 KiB | 20 Q