3v4l.org

run code in 300+ PHP versions simultaneously
<?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:  26
compiled vars:  !0 = $data, !1 = $zillow, !2 = $printed_data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E >   ASSIGN                                                   !0, <array>
   45     1        ASSIGN_DIM                                               !0
          2        OP_DATA                                                  <array>
   47     3        ASSIGN_DIM                                               !0
          4        OP_DATA                                                  <array>
   49     5        ASSIGN_DIM                                               !0
          6        OP_DATA                                                  <array>
   51     7        ASSIGN_DIM                                               !0
          8        OP_DATA                                                  <array>
   53     9        ASSIGN_DIM                                               !0
         10        OP_DATA                                                  <array>
   55    11        ASSIGN_DIM                                               !0
         12        OP_DATA                                                  <array>
   60    13        INIT_STATIC_METHOD_CALL                                  'Zillow', 'get_instance'
         14        DO_FCALL                                      0  $10     
         15        ASSIGN                                                   !1, $10
   61    16        INIT_METHOD_CALL                                         !1, 'sort'
         17        SEND_VAR_EX                                              !0
         18        DO_FCALL                                      0  $12     
         19        ASSIGN                                                   !2, $12
   63    20        ECHO                                                     '%3Cpre%3E'
   64    21        INIT_FCALL                                               'var_dump'
         22        SEND_VAR                                                 !2
         23        DO_ICALL                                                 
   65    24        ECHO                                                     '%3C%2Fpre%3E'
         25      > 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          unknown             ~0      'instance'
          1        IS_EQUAL                                                 ~0, null
          2      > JMPZ                                                     ~1, ->7
   12     3    >   NEW                          self                $3      
          4        DO_FCALL                                      0          
          5        ASSIGN_STATIC_PROP                                       'instance'
          6        OP_DATA                                                  $3
   15     7    >   FETCH_STATIC_PROP_R          unknown             ~5      'instance'
          8      > RETURN                                                   ~5
   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 8.0.0


preferences:
170.91 ms | 1400 KiB | 19 Q