3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Zillow { private static $instance = null; public static function get_instance() { if ( null == self::$instance ) { self::$instance = new self; } return self::$instance; } // end get_instance; private function __construct() { } // end constructor public static function sort($data=array()) { array_multisort( array_column($data, 'rent'), SORT_ASC, SORT_NUMERIC, array_column($data, 'street'), SORT_ASC, SORT_NATURAL, array_column($data, 'unit'), SORT_DESC, SORT_REGULAR, $data ); return $data; } // end array_orderby } // end class // Sample array() $data = array(); $data[] = array('id' => 1, 'number' => '130', 'street' => 'Battery St', 'unit' => '1', 'rent' => 1200); $data[] = array('id' => 1, 'number' => '130', 'street' => 'Battery St', 'unit' => '3', 'rent' => 1800); $data[] = array('id' => 1, 'number' => '1049', 'street' => 'Leavenworth St', 'unit' => '11', 'rent' => 800); $data[] = array('id' => 1, 'number' => '130', 'street' => 'Battery St', 'unit' => '10', 'rent' => 3400); $data[] = array('id' => 1, 'number' => '1059', 'street' => 'Leavenworth St', 'unit' => '10', 'rent' => 1450); $data[] = array('id' => 1, 'number' => '130', 'street' => 'Battery St', 'unit' => '5', 'rent' => 1000); $zillow = Zillow::get_instance(); $printed_data = $zillow->sort($data); echo '<pre>'; var_dump($printed_data); echo '</pre>';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OLYFs
function name:  (null)
number of ops:  27
compiled vars:  !0 = $data, !1 = $zillow, !2 = $printed_data
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NOP                                                      
  44     1        ASSIGN                                                   !0, <array>
  45     2        ASSIGN_DIM                                               !0
         3        OP_DATA                                                  <array>
  47     4        ASSIGN_DIM                                               !0
         5        OP_DATA                                                  <array>
  49     6        ASSIGN_DIM                                               !0
         7        OP_DATA                                                  <array>
  51     8        ASSIGN_DIM                                               !0
         9        OP_DATA                                                  <array>
  53    10        ASSIGN_DIM                                               !0
        11        OP_DATA                                                  <array>
  55    12        ASSIGN_DIM                                               !0
        13        OP_DATA                                                  <array>
  60    14        INIT_STATIC_METHOD_CALL                                  'Zillow', 'get_instance'
        15        DO_FCALL                                      0  $11     
        16        ASSIGN                                                   !1, $11
  61    17        INIT_METHOD_CALL                                         !1, 'sort'
        18        SEND_VAR_EX                                              !0
        19        DO_FCALL                                      0  $13     
        20        ASSIGN                                                   !2, $13
  63    21        ECHO                                                     '%3Cpre%3E'
  64    22        INIT_FCALL                                               'var_dump'
        23        SEND_VAR                                                 !2
        24        DO_ICALL                                                 
  65    25        ECHO                                                     '%3C%2Fpre%3E'
        26      > RETURN                                                   1

Class Zillow:
Function get_instance:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/OLYFs
function name:  get_instance
number of ops:  10
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  11     0  E >   FETCH_STATIC_PROP_R          global              $0      'instance'
         1        IS_EQUAL                                         ~1      null, $0
         2      > JMPZ                                                     ~1, ->7
  12     3    >   NEW                                              $3      :27
         4        DO_FCALL                                      0          
         5        FETCH_STATIC_PROP_W          global              $2      'instance'
         6        ASSIGN                                                   $2, $3
  15     7    >   FETCH_STATIC_PROP_R          global              $6      'instance'
         8      > RETURN                                                   $6
  17     9*     > RETURN                                                   null

End of function get_instance

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OLYFs
function name:  __construct
number of ops:  1
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  22     0  E > > RETURN                                                   null

End of function __construct

Function sort:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OLYFs
function name:  sort
number of ops:  27
compiled vars:  !0 = $data
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  25     0  E >   RECV_INIT                                        !0      <array>
  28     1        INIT_FCALL                                               'array_multisort'
  29     2        INIT_FCALL                                               'array_column'
         3        SEND_VAR                                                 !0
         4        SEND_VAL                                                 'rent'
         5        DO_ICALL                                         $1      
         6        SEND_VAL                                                 $1
         7        SEND_VAL                                                 4
         8        SEND_VAL                                                 1
  30     9        INIT_FCALL                                               'array_column'
        10        SEND_VAR                                                 !0
        11        SEND_VAL                                                 'street'
        12        DO_ICALL                                         $2      
        13        SEND_VAL                                                 $2
        14        SEND_VAL                                                 4
        15        SEND_VAL                                                 6
  31    16        INIT_FCALL                                               'array_column'
        17        SEND_VAR                                                 !0
        18        SEND_VAL                                                 'unit'
        19        DO_ICALL                                         $3      
        20        SEND_VAL                                                 $3
        21        SEND_VAL                                                 3
        22        SEND_VAL                                                 0
  32    23        SEND_REF                                                 !0
        24        DO_ICALL                                                 
  35    25      > RETURN                                                   !0
  37    26*     > RETURN                                                   null

End of function sort

End of class Zillow.

Generated using Vulcan Logic Dumper, using php 7.3.0