3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { private static $data = array( 'banana', 'cherry', 'apple' ); private static function sort_by_text( $first, $second ) { return strcasecmp( $first, $second ); } public static function sorted_data() { usort( self::$data, array( __CLASS__, 'sort_by_text' ) ); return self::$data; } } print_r( MyClass::sorted_data() ); $data = array( 'banana', 'cherry', 'apple' ); usort( $data, array( 'MyClass', 'sort_by_text' ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TURXG
function name:  (null)
number of ops:  11
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'print_r'
          1        INIT_STATIC_METHOD_CALL                                  'MyClass', 'sorted_data'
          2        DO_FCALL                                      0  $1      
          3        SEND_VAR                                                 $1
          4        DO_ICALL                                                 
   16     5        ASSIGN                                                   !0, <array>
   17     6        INIT_FCALL                                               'usort'
          7        SEND_REF                                                 !0
          8        SEND_VAL                                                 <array>
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Class MyClass:
Function sort_by_text:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TURXG
function name:  sort_by_text
number of ops:  8
compiled vars:  !0 = $first, !1 = $second
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        INIT_FCALL                                               'strcasecmp'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $2      
          6      > RETURN                                                   $2
    7     7*     > RETURN                                                   null

End of function sort_by_text

Function sorted_data:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TURXG
function name:  sorted_data
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'usort'
          1        FETCH_STATIC_PROP_W          unknown             $0      'data'
          2        SEND_REF                                                 $0
          3        SEND_VAL                                                 <array>
          4        DO_ICALL                                                 
   11     5        FETCH_STATIC_PROP_R          unknown             ~2      'data'
          6      > RETURN                                                   ~2
   12     7*     > RETURN                                                   null

End of function sorted_data

End of class MyClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.08 ms | 1396 KiB | 19 Q