Guest User

Untitled

a guest
Jul 17th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. function eat_apple($apple)
  2. {
  3. return true;
  4. }
  5.  
  6. function eat_apple()
  7. {
  8. $apple = func_get_arg(0);
  9. return true;
  10. }
  11.  
  12. <?php
  13. function display ($a, $b, $c) {
  14. echo $a . " is " . $b . " " . $c;
  15. }
  16. ?>
  17.  
  18. <?php
  19. display ("Rock", "good", "boy");
  20. - this will not throw any error.
  21.  
  22. display ("Rock", "good");
  23. - this will throw fatal error.
  24. ?>
  25.  
  26. class a{
  27. function X(MyOBJ $obj){...}
  28. }
  29.  
  30. class b extends a{
  31. function X(string $s,int $i){...}
  32. }
  33. class c extends b{
  34. function X(){...}
  35. }
  36.  
  37. //not good, you can only send 3 strings
  38. function merge_strings($s1, $s2, $s3){
  39. return $s1 . $s2 . $s3;
  40. }
  41.  
  42. //good one
  43. function merge_strings(){
  44. return join('',func_get_args());
  45. }
  46.  
  47. -function eat_apple($apple)
  48. +function eat_apple()
  49. {
  50. + $apple = func_get_arg(0);
  51. return true;
  52. }
Add Comment
Please, Sign In to add comment