3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array( '/foo/' => '1', '/foo' => '2', '/foo/bar/baz' => '3', '/foo/bar/b' => '4' ); function sort_keys_by_length_desc(array $a) { $lengths = array_map('strlen', array_keys($a)); $temp = $a; array_multisort($lengths, SORT_DESC, $temp); return $temp; } var_dump(sort_keys_by_length_desc($a));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sJlqG
function name:  (null)
number of ops:  8
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   18     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'sort_keys_by_length_desc'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function sort_keys_by_length_desc:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sJlqG
function name:  sort_keys_by_length_desc
number of ops:  17
compiled vars:  !0 = $a, !1 = $lengths, !2 = $temp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        INIT_FCALL                                               'array_map'
          2        SEND_VAL                                                 'strlen'
          3        INIT_FCALL                                               'array_keys'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $3      
          6        SEND_VAR                                                 $3
          7        DO_ICALL                                         $4      
          8        ASSIGN                                                   !1, $4
   13     9        ASSIGN                                                   !2, !0
   14    10        INIT_FCALL                                               'array_multisort'
         11        SEND_REF                                                 !1
         12        SEND_VAL                                                 3
         13        SEND_REF                                                 !2
         14        DO_ICALL                                                 
   15    15      > RETURN                                                   !2
   16    16*     > RETURN                                                   null

End of function sort_keys_by_length_desc

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.25 ms | 1402 KiB | 22 Q