3v4l.org

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

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/slZeW
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/slZeW
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/slZeW
function name:  __toString
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   FETCH_OBJ_R                                          ~0      'value'
          1        VERIFY_RETURN_TYPE                                           ~0
          2      > RETURN                                                       ~0
   17     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:
168.66 ms | 1122 KiB | 17 Q