3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); function test(int $X): int|string { if($X % 2 == 0) { return $X * 2; } else { return "{$X}"; } } echo test((int)"13");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/puIWs
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'test'
          1        CAST                                          4  ~0      '13'
          2        SEND_VAL                                                 ~0
          3        DO_FCALL                                      0  $1      
          4        ECHO                                                     $1
          5      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/puIWs
function name:  test
number of ops:  13
compiled vars:  !0 = $X
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        MOD                                              ~1      !0, 2
          2        IS_EQUAL                                                 ~1, 0
          3      > JMPZ                                                     ~2, ->8
    6     4    >   MUL                                              ~3      !0, 2
          5        VERIFY_RETURN_TYPE                                       ~3
          6      > RETURN                                                   ~3
          7*       JMP                                                      ->11
    8     8    >   CAST                                          6  ~4      !0
          9        VERIFY_RETURN_TYPE                                       ~4
         10      > RETURN                                                   ~4
   10    11*       VERIFY_RETURN_TYPE                                       
         12*     > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.18 ms | 1397 KiB | 14 Q