3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ ['id' => 1, 'VALUE' => 'г. Москва'], ['id' => 2, 'VALUE' => 'д. Волки'], ['id' => 3, 'VALUE' => 'х. Орехово'], ['id' => 4, 'VALUE' => 'пос. Братылёво'], ]; usort($data, function($a, $b) { $a = preg_split('/\s+/', $a['VALUE'], 2); $b = preg_split('/\s+/', $b['VALUE'], 2); return $a[1] <=> $b[1]; }); echo json_encode($data, JSON_UNESCAPED_UNICODE)."\n"; echo json_encode(array_map(function($a){return $a['VALUE'];}, $data), JSON_UNESCAPED_UNICODE)."\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tQDpL
function name:  (null)
number of ops:  24
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        INIT_FCALL                                               'usort'
          2        SEND_REF                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FtQDpL%3A10%240'
   14     4        SEND_VAL                                                 ~2
          5        DO_ICALL                                                 
   16     6        INIT_FCALL                                               'json_encode'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 256
          9        DO_ICALL                                         $4      
         10        CONCAT                                           ~5      $4, '%0A'
         11        ECHO                                                     ~5
   17    12        INIT_FCALL                                               'json_encode'
         13        INIT_FCALL                                               'array_map'
         14        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FtQDpL%3A17%241'
         15        SEND_VAL                                                 ~6
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                         $7      
         18        SEND_VAR                                                 $7
         19        SEND_VAL                                                 256
         20        DO_ICALL                                         $8      
         21        CONCAT                                           ~9      $8, '%0A'
         22        ECHO                                                     ~9
         23      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FtQDpL%3A10%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tQDpL
function name:  {closure}
number of ops:  21
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        INIT_FCALL                                               'preg_split'
          3        SEND_VAL                                                 '%2F%5Cs%2B%2F'
          4        FETCH_DIM_R                                      ~2      !0, 'VALUE'
          5        SEND_VAL                                                 ~2
          6        SEND_VAL                                                 2
          7        DO_ICALL                                         $3      
          8        ASSIGN                                                   !0, $3
   12     9        INIT_FCALL                                               'preg_split'
         10        SEND_VAL                                                 '%2F%5Cs%2B%2F'
         11        FETCH_DIM_R                                      ~5      !1, 'VALUE'
         12        SEND_VAL                                                 ~5
         13        SEND_VAL                                                 2
         14        DO_ICALL                                         $6      
         15        ASSIGN                                                   !1, $6
   13    16        FETCH_DIM_R                                      ~8      !0, 1
         17        FETCH_DIM_R                                      ~9      !1, 1
         18        SPACESHIP                                        ~10     ~8, ~9
         19      > RETURN                                                   ~10
   14    20*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FtQDpL%3A10%240

Function %00%7Bclosure%7D%2Fin%2FtQDpL%3A17%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tQDpL
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        FETCH_DIM_R                                      ~1      !0, 'VALUE'
          2      > RETURN                                                   ~1
          3*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FtQDpL%3A17%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
202.41 ms | 1400 KiB | 21 Q