3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=0); class Test { private array $array; private string $string; public function __construct() { // $this->array = 1; // Fatal error $this->array = (array) 1; // ok, [1] $this->string = 1; // ok, '1' } public function getArray(): array { return $this->array; // ok } public function getAnotherArray(): array { // return 1; // Fatal error return (array) 1; // ok, [1] } public function getString(): string { return $this->string; } } $test = new Test(); var_dump($test->getArray(), $test->getAnotherArray(), $test->getString());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UkmqW
function name:  (null)
number of ops:  15
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   NEW                                              $1      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   36     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'getArray'
          5        DO_FCALL                                      0  $4      
          6        SEND_VAR                                                 $4
          7        INIT_METHOD_CALL                                         !0, 'getAnotherArray'
          8        DO_FCALL                                      0  $5      
          9        SEND_VAR                                                 $5
         10        INIT_METHOD_CALL                                         !0, 'getString'
         11        DO_FCALL                                      0  $6      
         12        SEND_VAR                                                 $6
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Class Test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UkmqW
function name:  __construct
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   CAST                                          7  ~1      1
          1        ASSIGN_OBJ                                               'array'
          2        OP_DATA                                                  ~1
   13     3        ASSIGN_OBJ                                               'string'
          4        OP_DATA                                                  1
   15     5      > RETURN                                                   null

End of function __construct

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

End of function getarray

Function getanotherarray:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UkmqW
function name:  getAnotherArray
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   CAST                                          7  ~0      1
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   26     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function getanotherarray

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

End of function getstring

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.95 ms | 1010 KiB | 14 Q