3v4l.org

run code in 300+ PHP versions simultaneously
<?php $c = new Collator("en_US"); // should work with any locale $a = ["02#aa", "02#ab", "03#a", "02#a", "03#x", "03#b", "03#ba", "03#b", "04#a", "03#f"]; echo 'collator sort:' . PHP_EOL; $c->sort($a, Collator::SORT_STRING); // SORT_REGULAR produces same result var_dump($a); echo 'expected results:' . PHP_EOL; sort($a, SORT_STRING); var_dump($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qJR25
function name:  (null)
number of ops:  23
compiled vars:  !0 = $c, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $2      'Collator'
          1        SEND_VAL_EX                                              'en_US'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
    5     4        ASSIGN                                                   !1, <array>
    7     5        ECHO                                                     'collator+sort%3A%0A'
    8     6        INIT_METHOD_CALL                                         !0, 'sort'
          7        SEND_VAR_EX                                              !1
          8        FETCH_CLASS_CONSTANT                             ~6      'Collator', 'SORT_STRING'
          9        SEND_VAL_EX                                              ~6
         10        DO_FCALL                                      0          
    9    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                                 
   11    14        ECHO                                                     'expected+results%3A%0A'
   12    15        INIT_FCALL                                               'sort'
         16        SEND_REF                                                 !1
         17        SEND_VAL                                                 2
         18        DO_ICALL                                                 
   13    19        INIT_FCALL                                               'var_dump'
         20        SEND_VAR                                                 !1
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.22 ms | 1399 KiB | 17 Q