3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MethodCallClass { public function test(): array|null {} } class HelloWorld { /** @var MethodCallClass|null */ private $property = null; public function testCoalesce(): void { $this->property->test()['test'] ?? throw new Exception(); } public function testIseet(): void { isset($this->property->test()['test']) ? 'test' : throw new Exception(); } } //(new HelloWorld())->testCoalesce(); (new HelloWorld())->testIseet();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/a9ITP
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   NEW                                              $0      'HelloWorld'
          1        DO_FCALL                                      0          
          2        INIT_METHOD_CALL                                         $0, 'testIseet'
          3        DO_FCALL                                      0          
          4      > RETURN                                                   1

Class MethodCallClass:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/a9ITP
function name:  test
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   VERIFY_RETURN_TYPE                                       
          1      > RETURN                                                   null

End of function test

End of class MethodCallClass.

Class HelloWorld:
Function testcoalesce:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/a9ITP
function name:  testCoalesce
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   FETCH_OBJ_R                                      ~0      'property'
          1        INIT_METHOD_CALL                                         ~0, 'test'
          2        DO_FCALL                                      0  $1      
          3        FETCH_DIM_IS                                     ~2      $1, 'test'
          4        COALESCE                                         ~3      ~2
          5        NEW                                              $4      'Exception'
          6        DO_FCALL                                      0          
          7      > THROW                                         1          $4
          8*       QM_ASSIGN                                        ~3      <true>
          9*       FREE                                                     ~3
   15    10*     > RETURN                                                   null

End of function testcoalesce

Function testiseet:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/a9ITP
function name:  testIseet
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   FETCH_OBJ_R                                      ~0      'property'
          1        INIT_METHOD_CALL                                         ~0, 'test'
          2        DO_FCALL                                      0  $1      
          3        ISSET_ISEMPTY_DIM_OBJ                         0          $1, 'test'
          4      > JMPZ                                                     ~2, ->7
          5    >   QM_ASSIGN                                        ~3      'test'
          6      > JMP                                                      ->11
          7    >   NEW                                              $4      'Exception'
          8        DO_FCALL                                      0          
          9      > THROW                                         1          $4
         10*       QM_ASSIGN                                        ~3      <true>
         11    >   FREE                                                     ~3
   19    12      > RETURN                                                   null

End of function testiseet

End of class HelloWorld.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
277.59 ms | 1090 KiB | 13 Q