Advertisement
aldinokemal

Function - Parameter & Return Type

Sep 25th, 2022
987
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3.  
  4. function sum(int $a, int $b): int {
  5.     return $a + $b;
  6. }
  7.  
  8. echo sum(4, 5); // 9
  9. echo sum(4.0, 5.2); // 9 | bukan 9.2
  10.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement