3v4l.org

run code in 500+ PHP versions simultaneously
<?php declare(strict_types = 1); // lint >= 8.1 final class Foo implements \Stringable { private function __construct(public readonly string $value) { } public static function fromString(string $string): self { return new self($string); } public function __toString(): string { return $this->value; } } function userlandComparator(string $a, string $b): int { return strnatcasecmp($a, $b); } $options = [ Foo::fromString('c'), Foo::fromString('b'), Foo::fromString('a'), ]; uasort($options, 'userlandComparator'); var_dump($options);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gEURZ
function name:  (null)
number of ops:  22
compiled vars:  !0 = $options
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                                'foo'
   23     1        INIT_STATIC_METHOD_CALL                                      'Foo', 'fromString'
          2        SEND_VAL_EX                                                  'c'
          3        DO_FCALL                                          0  $1      
          4        INIT_ARRAY                                           ~2      $1
   24     5        INIT_STATIC_METHOD_CALL                                      'Foo', 'fromString'
          6        SEND_VAL_EX                                                  'b'
          7        DO_FCALL                                          0  $3      
          8        ADD_ARRAY_ELEMENT                                    ~2      $3
   25     9        INIT_STATIC_METHOD_CALL                                      'Foo', 'fromString'
         10        SEND_VAL_EX                                                  'a'
         11        DO_FCALL                                          0  $4      
         12        ADD_ARRAY_ELEMENT                                    ~2      $4
   22    13        ASSIGN                                                       !0, ~2
   29    14        INIT_FCALL                                                   'uasort'
         15        SEND_REF                                                     !0
         16        SEND_VAL                                                     'userlandComparator'
         17        DO_ICALL                                                     
   30    18        INIT_FCALL                                                   'var_dump'
         19        SEND_VAR                                                     !0
         20        DO_ICALL                                                     
         21      > RETURN                                                       1

Function userlandcomparator:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gEURZ
function name:  userlandComparator
number of ops:  10
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   18     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   19     2        INIT_FCALL                                                   'strnatcasecmp'
          3        SEND_VAR                                                     !0
          4        SEND_VAR                                                     !1
          5        DO_ICALL                                             $2      
          6        VERIFY_RETURN_TYPE                                           $2
          7      > RETURN                                                       $2
   20     8*       VERIFY_RETURN_TYPE                                           
          9*     > RETURN                                                       null

End of function userlandcomparator

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gEURZ
function name:  __construct
number of ops:  4
compiled vars:  !0 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   RECV                                                 !0      
          1        ASSIGN_OBJ                                                   'value'
          2        OP_DATA                                                      !0
    6     3      > RETURN                                                       null

End of function __construct

Function fromstring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gEURZ
function name:  fromString
number of ops:  8
compiled vars:  !0 = $string
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   RECV                                                 !0      
    9     1        NEW                              self                $1      
          2        SEND_VAR_EX                                                  !0
          3        DO_FCALL                                          0          
          4        VERIFY_RETURN_TYPE                                           $1
          5      > RETURN                                                       $1
   10     6*       VERIFY_RETURN_TYPE                                           
          7*     > RETURN                                                       null

End of function fromstring

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gEURZ
function name:  __toString
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   FETCH_OBJ_R                                          ~0      'value'
          1        VERIFY_RETURN_TYPE                                           ~0
          2      > RETURN                                                       ~0
   14     3*       VERIFY_RETURN_TYPE                                           
          4*     > RETURN                                                       null

End of function __tostring

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
172.53 ms | 3403 KiB | 16 Q