Search code examples
phpphpmailer

What's the difference between include, require and use functions in php?


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


Solution

  • 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?