Guest User

Untitled

a guest
Jun 10th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. <?php
  2. $hostName='localhost';
  3. $userName='xxxxxxxxx';
  4. $userPass='xxxxxxxxx';
  5. ?>
  6.  
  7. <?php
  8. include 'db.php';
  9. echo $hostName;
  10. ?>
  11.  
  12. <?php
  13. $settings = 'my setting';
  14. ?>
  15.  
  16. include_once "settings.php"
  17. ...
  18. class MyClass {
  19. ....
  20. include_once "settings.php" //does nothing since file is already included
  21. //I can't reach $settings from here.
  22. }
  23. ...
  24.  
  25. include_once "settings.php"
  26. ...
  27. class MyClass {
  28. ....
  29. include "settings.php" //includes file again
  30. //I can reach $settings here
  31. }
  32. ...
  33.  
  34. $settings = 'my setting';
  35. ...
  36. class MyClass {
  37. ....
  38. //I can't reach $settings from here.
  39. }
  40. ...
  41.  
  42. $settings = 'my setting';
  43. ...
  44. class MyClass {
  45. ....
  46. $settings = 'my setting';
  47. //I can use $settings here obviously
  48. }
  49. ...
Add Comment
Please, Sign In to add comment