3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ (object)['label' => '3-6 Months'], (object)['label' => '0-3 Months'], (object)['label' => '6-12 Months'], (object)['label' => '12-18 Months'], ]; $foo = function($a, $b) { return strnatcmp($a->label, $b->label); }; var_dump($array); print_r($array); usort($array, $foo); print_r($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SMhJS
function name:  (null)
number of ops:  25
compiled vars:  !0 = $array, !1 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   CAST                                          8  ~2      <array>
          1        INIT_ARRAY                                       ~3      ~2
    5     2        CAST                                          8  ~4      <array>
          3        ADD_ARRAY_ELEMENT                                ~3      ~4
    6     4        CAST                                          8  ~5      <array>
          5        ADD_ARRAY_ELEMENT                                ~3      ~5
    7     6        CAST                                          8  ~6      <array>
          7        ADD_ARRAY_ELEMENT                                ~3      ~6
    3     8        ASSIGN                                                   !0, ~3
   11     9        DECLARE_LAMBDA_FUNCTION                          ~8      [0]
         10        ASSIGN                                                   !1, ~8
   16    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                                 
   17    14        INIT_FCALL                                               'print_r'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                                 
   20    17        INIT_FCALL                                               'usort'
         18        SEND_REF                                                 !0
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                                 
   22    21        INIT_FCALL                                               'print_r'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                                 
         24      > 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/SMhJS
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   12     2        INIT_FCALL                                               'strnatcmp'
          3        FETCH_OBJ_R                                      ~2      !0, 'label'
          4        SEND_VAL                                                 ~2
          5        FETCH_OBJ_R                                      ~3      !1, 'label'
          6        SEND_VAL                                                 ~3
          7        DO_ICALL                                         $4      
          8      > RETURN                                                   $4
   13     9*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.98 ms | 1002 KiB | 17 Q