0

Trying to implement forgotten password functionality in my website and a tutorial I'm watching uses the 'use' function to link to the PHPMailer folder but my files are structured differently and I'm not sure how to do it properly. The use function seems to have different syntax than the include or require from what I've gathered so far.

Googled this already and found nothing of any substance on the 'use' function. Can anyone help me out or link something that can? Much appreciated

CathCoder
  • 21
  • 4

1 Answers1

3

require() and include() simply add that file into your script. use, on the other hand, has to do with namespaces.

See also: What are namespace?

KIKO Software
  • 15,283
  • 3
  • 18
  • 33
  • 1
    This is correct. It’s common for new users to confuse the two, which may in part be due to the namespace-to-path mapping defined by PSR-4. The important thing to understand is that the `use` statements will typically *not* change if you move the files. – Synchro Jan 17 '21 at 13:45