3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); class TheClass { /** @var int */ public $seven = 7; public function getFive(): int { return 5; } public static function getSevenStrangelyButSafely(?TheClass $object): int { return $object->seven ?? 7; } public static function getFiveUnsafely(?TheClass $object): int { return $object->getFive() ?? 5; } } $value = TheClass::getSevenStrangelyButSafely(null); $value = TheClass::getFiveUnsafely(null);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3GaDe
function name:  (null)
number of ops:  9
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   INIT_STATIC_METHOD_CALL                                  'TheClass', 'getSevenStrangelyButSafely'
          1        SEND_VAL                                                 null
          2        DO_FCALL                                      0  $1      
          3        ASSIGN                                                   !0, $1
   24     4        INIT_STATIC_METHOD_CALL                                  'TheClass', 'getFiveUnsafely'
          5        SEND_VAL                                                 null
          6        DO_FCALL                                      0  $3      
          7        ASSIGN                                                   !0, $3
          8      > RETURN                                                   1

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

End of function getfive

Function getsevenstrangelybutsafely:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3GaDe
function name:  getSevenStrangelyButSafely
number of ops:  8
compiled vars:  !0 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   14     1        FETCH_OBJ_IS                                     ~1      !0, 'seven'
          2        COALESCE                                         ~2      ~1
          3        QM_ASSIGN                                        ~2      7
          4        VERIFY_RETURN_TYPE                                       ~2
          5      > RETURN                                                   ~2
   15     6*       VERIFY_RETURN_TYPE                                       
          7*     > RETURN                                                   null

End of function getsevenstrangelybutsafely

Function getfiveunsafely:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3GaDe
function name:  getFiveUnsafely
number of ops:  9
compiled vars:  !0 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   19     1        INIT_METHOD_CALL                                         !0, 'getFive'
          2        DO_FCALL                                      0  $1      
          3        COALESCE                                         ~2      $1
          4        QM_ASSIGN                                        ~2      5
          5        VERIFY_RETURN_TYPE                                       ~2
          6      > RETURN                                                   ~2
   20     7*       VERIFY_RETURN_TYPE                                       
          8*     > RETURN                                                   null

End of function getfiveunsafely

End of class TheClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.21 ms | 1399 KiB | 13 Q