Underscore in php function

Stepppo picture Stepppo · Nov 30, 2009 · Viewed 12.1k times · Source

What does it mean when a PHP function name begins with an underscore?

for example: __construct()

I know what the construct means but I've seen other places where the function begins with an underscore, or a double underscore and I'm just not sure of the significance.

Answer

Jacob Relkin picture Jacob Relkin · Nov 30, 2009

It means that PHP calls it implicitly.

It's called a 'Magic Method'

Also, it's two underscores, not one.

Learn more here: PHP Magic Methods