3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '[{"Variable":"Hello","Variable1":20}, {"Variable":"Hi","Variable1":30}, {"Variable":"How","Variable1":40}, {"Variable":"Who","Variable1":50}, {"Variable":"Where","Variable1":60}, {"Variable":"This","Variable1":100}, {"Variable":"Pork","Variable1":10}, {"Variable":"Creep","Variable1":90}, {"Variable":"Mega Creeps","Variable1":80}, {"Variable":"LOL","Variable1":0}, {"Variable":"ROFL","Variable1":0}, {"Variable":"LMAO","Variable1":0}, {"Variable":"POP","Variable1":0}, {"Variable":"LOVE","Variable1":0}, {"Variable":"PICK","Variable1":0}, {"Variable":"WHIZ","Variable1":0}, {"Variable":"BORED","Variable1":0}, {"Variable":"KILLAH","Variable1":0}, {"Variable":"LOLLING","Variable1":0}, {"Variable":"HALOO HALOO","Variable1":0}]'; $array = json_decode($json); usort($array, function($a, $b) { return $b->Variable1 <=> $a->Variable1; }); $parts = array_slice($array, 0, 10); echo json_encode($parts);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WkiG0
function name:  (null)
number of ops:  21
compiled vars:  !0 = $json, !1 = $array, !2 = $parts
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%5B%7B%22Variable%22%3A%22Hello%22%2C%22Variable1%22%3A20%7D%2C+%7B%22Variable%22%3A%22Hi%22%2C%22Variable1%22%3A30%7D%2C%0A++++++++++++%7B%22Variable%22%3A%22How%22%2C%22Variable1%22%3A40%7D%2C+%7B%22Variable%22%3A%22Who%22%2C%22Variable1%22%3A50%7D%2C%0A++++++++++++%7B%22Variable%22%3A%22Where%22%2C%22Variable1%22%3A60%7D%2C+%7B%22Variable%22%3A%22This%22%2C%22Variable1%22%3A100%7D%2C%0A++++++++++++%7B%22Variable%22%3A%22Pork%22%2C%22Variable1%22%3A10%7D%2C+%7B%22Variable%22%3A%22Creep%22%2C%22Variable1%22%3A90%7D%2C%0A++++++++++++%7B%22Variable%22%3A%22Mega+Creeps%22%2C%22Variable1%22%3A80%7D%2C+%7B%22Variable%22%3A%22LOL%22%2C%22Variable1%22%3A0%7D%2C%0A++++++++++++%7B%22Variable%22%3A%22ROFL%22%2C%22Variable1%22%3A0%7D%2C+%7B%22Variable%22%3A%22LMAO%22%2C%22Variable1%22%3A0%7D%2C%0A++++++++++++%7B%22Variable%22%3A%22POP%22%2C%22Variable1%22%3A0%7D%2C+%7B%22Variable%22%3A%22LOVE%22%2C%22Variable1%22%3A0%7D%2C%0A++++++++++++%7B%22Variable%22%3A%22PICK%22%2C%22Variable1%22%3A0%7D%2C+%7B%22Variable%22%3A%22WHIZ%22%2C%22Variable1%22%3A0%7D%2C%0A++++++++++++%7B%22Variable%22%3A%22BORED%22%2C%22Variable1%22%3A0%7D%2C+%7B%22Variable%22%3A%22KILLAH%22%2C%22Variable1%22%3A0%7D%2C%0A++++++++++++%7B%22Variable%22%3A%22LOLLING%22%2C%22Variable1%22%3A0%7D%2C+%7B%22Variable%22%3A%22HALOO++HALOO%22%2C%22Variable1%22%3A0%7D%5D'
   13     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !1, $4
   15     5        INIT_FCALL                                               'usort'
          6        SEND_REF                                                 !1
          7        DECLARE_LAMBDA_FUNCTION                          ~6      [0]
   17     8        SEND_VAL                                                 ~6
   15     9        DO_ICALL                                                 
   19    10        INIT_FCALL                                               'array_slice'
         11        SEND_VAR                                                 !1
         12        SEND_VAL                                                 0
         13        SEND_VAL                                                 10
         14        DO_ICALL                                         $8      
         15        ASSIGN                                                   !2, $8
   21    16        INIT_FCALL                                               'json_encode'
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                         $10     
         19        ECHO                                                     $10
         20      > 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/WkiG0
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   16     2        FETCH_OBJ_R                                      ~2      !1, 'Variable1'
          3        FETCH_OBJ_R                                      ~3      !0, 'Variable1'
          4        SPACESHIP                                        ~4      ~2, ~3
          5      > RETURN                                                   ~4
   17     6*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.32 ms | 1018 KiB | 17 Q