Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. <?php
  2. function sayHello(string $name = "Dr.Manhattan"):string{
  3. return "hello $name";}
  4.  
  5. function whoAmI(string $name, array $watchmen=[]):string{
  6. array_push($watchmen, 'Dr. Manhattan',
  7. 'Ozymandias',
  8. 'Silk Spectre',
  9. 'Rorschach',
  10. 'The comedian',
  11. 'Nite Owl') ;
  12.  
  13. $answer = "$name n'est pas un watchman";
  14. foreach ($watchmen as $watchman){
  15. if ($name == $watchman){
  16. $answer = "$name is a watchmen";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement