3v4l.org

run code in 500+ PHP versions simultaneously
<?php declare(strict_types=1); function floatValues(float ...$values): array { return $values; } function integerValues(int ...$values): array { return $values; } $array = floatValues(1.1, 2.1); // [1.1, 2.1] print_r($array); $array = integerValues(1, 2); // [1, 2] print_r($array); $one = 1; var_dump($one); // This should throw TypeError, but converts int to float $array = floatValues($one, 2); // [1, 2] var_dump($array); // This throws TypeError as expected integerValues(1.1, 2.1);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EJrPV
function name:  (null)
number of ops:  33
compiled vars:  !0 = $array, !1 = $one
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                                   'floatvalues'
          1        SEND_VAL                                                     1.1
          2        SEND_VAL                                                     2.1
          3        DO_FCALL                                          0  $2      
          4        ASSIGN                                                       !0, $2
   16     5        INIT_FCALL                                                   'print_r'
          6        SEND_VAR                                                     !0
          7        DO_ICALL                                                     
   17     8        INIT_FCALL                                                   'integervalues'
          9        SEND_VAL                                                     1
         10        SEND_VAL                                                     2
         11        DO_FCALL                                          0  $5      
         12        ASSIGN                                                       !0, $5
   18    13        INIT_FCALL                                                   'print_r'
         14        SEND_VAR                                                     !0
         15        DO_ICALL                                                     
   19    16        ASSIGN                                                       !1, 1
   20    17        INIT_FCALL                                                   'var_dump'
         18        SEND_VAR                                                     !1
         19        DO_ICALL                                                     
   22    20        INIT_FCALL                                                   'floatvalues'
         21        SEND_VAR                                                     !1
         22        SEND_VAL                                                     2
         23        DO_FCALL                                          0  $10     
         24        ASSIGN                                                       !0, $10
   23    25        INIT_FCALL                                                   'var_dump'
         26        SEND_VAR                                                     !0
         27        DO_ICALL                                                     
   25    28        INIT_FCALL                                                   'integervalues'
         29        SEND_VAL                                                     1.1
         30        SEND_VAL                                                     2.1
         31        DO_FCALL                                          0          
         32      > RETURN                                                       1

Function floatvalues:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EJrPV
function name:  floatValues
number of ops:  5
compiled vars:  !0 = $values
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   RECV_VARIADIC                                        !0      
    7     1        VERIFY_RETURN_TYPE                                           !0
          2      > RETURN                                                       !0
    8     3*       VERIFY_RETURN_TYPE                                           
          4*     > RETURN                                                       null

End of function floatvalues

Function integervalues:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EJrPV
function name:  integerValues
number of ops:  5
compiled vars:  !0 = $values
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   RECV_VARIADIC                                        !0      
   12     1        VERIFY_RETURN_TYPE                                           !0
          2      > RETURN                                                       !0
   13     3*       VERIFY_RETURN_TYPE                                           
          4*     > RETURN                                                       null

End of function integervalues

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
129.08 ms | 486 KiB | 13 Q