3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function cmp($a, $b) { if ($a['sort'] == $b['sort']) { return 0; } return ($a['sort'] < $b['sort']) ? -1 : 1; } $a[] = array('name' => 'a1', 'sort'=>3); $a[] = array('name' => 'b2', 'sort'=>2); $a[] = array('name' => 'c3', 'sort'=>1); usort($a, "cmp"); print_r($a);
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/IK1ur
function name:  (null)
number of ops:  15
compiled vars:  !0 = $a
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NOP                                                      
  13     1        ASSIGN_DIM                                               !0
         2        OP_DATA                                                  <array>
  14     3        ASSIGN_DIM                                               !0
         4        OP_DATA                                                  <array>
  15     5        ASSIGN_DIM                                               !0
         6        OP_DATA                                                  <array>
  17     7        INIT_FCALL                                               'usort'
         8        SEND_REF                                                 !0
         9        SEND_VAL                                                 'cmp'
        10        DO_ICALL                                                 
  19    11        INIT_FCALL                                               'print_r'
        12        SEND_VAR                                                 !0
        13        DO_ICALL                                                 
        14      > RETURN                                                   1

Function cmp:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
Jump found. Position 1 = -2
Branch analysis from position: 7
Jump found. Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
Jump found. Position 1 = 14
Branch analysis from position: 14
Jump found. Position 1 = -2
Branch analysis from position: 13
Jump found. Position 1 = -2
filename:       /in/IK1ur
function name:  cmp
number of ops:  16
compiled vars:  !0 = $a, !1 = $b
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   RECV                                             !0      
         1        RECV                                             !1      
   5     2        FETCH_DIM_R                                      $2      !0, 'sort'
         3        FETCH_DIM_R                                      $3      !1, 'sort'
         4        IS_EQUAL                                         ~4      $2, $3
         5      > JMPZ                                                     ~4, ->7
   6     6    > > RETURN                                                   0
   8     7    >   FETCH_DIM_R                                      $5      !0, 'sort'
         8        FETCH_DIM_R                                      $6      !1, 'sort'
         9        IS_SMALLER                                       ~7      $5, $6
        10      > JMPZ                                                     ~7, ->13
        11    >   QM_ASSIGN                                        ~8      -1
        12      > JMP                                                      ->14
        13    >   QM_ASSIGN                                        ~8      1
        14    > > RETURN                                                   ~8
   9    15*     > RETURN                                                   null

End of function cmp

Generated using Vulcan Logic Dumper, using php 7.2.0