3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = '[ { "name": "Sally", "nick_name": "sal", "availability": "0", "is_fav": "0" }, { "name": "David", "nick_name": "dav07", "availability": "0", "is_fav": "1" }, { "name": "Zen", "nick_name": "zen", "availability": "1", "is_fav": "0" }, { "name": "Jackson", "nick_name": "jack", "availability": "1", "is_fav": "1" }, { "name": "Rohit", "nick_name": "rod", "availability": "0", "is_fav": "0" } ]'; $arr = json_decode($data, true); // Obtain a list of columns foreach ($arr as $key => $row) { $isFav[$key] = $row['is_fav']; $avail[$key] = $row['availability']; $names[$key] = $row['nick_name']; } // Sort the data with isFav descending, avail descending // Add $arr as the last parameter, to sort by the common key array_multisort($isFav, SORT_DESC, $avail, SORT_DESC, $names, SORT_DESC, $arr); echo "<pre>"; print_r($arr);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 19
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 19
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/f6sMQ
function name:  (null)
number of ops:  34
compiled vars:  !0 = $data, !1 = $arr, !2 = $row, !3 = $key, !4 = $isFav, !5 = $avail, !6 = $names
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%5B%0A++++%7B%0A++++++++%22name%22%3A+%22Sally%22%2C%0A++++++++%22nick_name%22%3A+%22sal%22%2C%0A++++++++%22availability%22%3A+%220%22%2C%0A++++++++%22is_fav%22%3A+%220%22%0A++++%7D%2C%0A++++%7B%0A++++++++%22name%22%3A+%22David%22%2C%0A++++++++%22nick_name%22%3A+%22dav07%22%2C%0A++++++++%22availability%22%3A+%220%22%2C%0A++++++++%22is_fav%22%3A+%221%22%0A++++%7D%2C%0A++++%7B%0A++++++++%22name%22%3A+%22Zen%22%2C%0A++++++++%22nick_name%22%3A+%22zen%22%2C%0A++++++++%22availability%22%3A+%221%22%2C%0A++++++++%22is_fav%22%3A+%220%22%0A++++%7D%2C%0A++++%7B%0A++++++++%22name%22%3A+%22Jackson%22%2C%0A++++++++%22nick_name%22%3A+%22jack%22%2C%0A++++++++%22availability%22%3A+%221%22%2C%0A++++++++%22is_fav%22%3A+%221%22%0A++++%7D%2C%0A++++%7B%0A++++++++%22name%22%3A+%22Rohit%22%2C%0A++++++++%22nick_name%22%3A+%22rod%22%2C%0A++++++++%22availability%22%3A+%220%22%2C%0A++++++++%22is_fav%22%3A+%220%22%0A++++%7D%0A%5D'
   34     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $8      
          5        ASSIGN                                                   !1, $8
   36     6      > FE_RESET_R                                       $10     !1, ->19
          7    > > FE_FETCH_R                                       ~11     $10, !2, ->19
          8    >   ASSIGN                                                   !3, ~11
   37     9        FETCH_DIM_R                                      ~14     !2, 'is_fav'
         10        ASSIGN_DIM                                               !4, !3
         11        OP_DATA                                                  ~14
   38    12        FETCH_DIM_R                                      ~16     !2, 'availability'
         13        ASSIGN_DIM                                               !5, !3
         14        OP_DATA                                                  ~16
   39    15        FETCH_DIM_R                                      ~18     !2, 'nick_name'
         16        ASSIGN_DIM                                               !6, !3
         17        OP_DATA                                                  ~18
   36    18      > JMP                                                      ->7
         19    >   FE_FREE                                                  $10
   44    20        INIT_FCALL                                               'array_multisort'
         21        SEND_REF                                                 !4
         22        SEND_VAL                                                 3
         23        SEND_REF                                                 !5
         24        SEND_VAL                                                 3
         25        SEND_REF                                                 !6
         26        SEND_VAL                                                 3
         27        SEND_REF                                                 !1
         28        DO_ICALL                                                 
   46    29        ECHO                                                     '%3Cpre%3E'
   47    30        INIT_FCALL                                               'print_r'
         31        SEND_VAR                                                 !1
         32        DO_ICALL                                                 
         33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.97 ms | 1009 KiB | 16 Q