I saw many tutorials underscores (_) are used in function.
But I don't know why it is used and how can I use ?
Like this :
function _save_cart()
{
}
I saw many tutorials underscores (_) are used in function.
But I don't know why it is used and how can I use ?
Like this :
function _save_cart()
{
}
In objective languages functions and variables names seperate with capitalize char, forexample: saveCart(), getCart(), ...
But in functional languages people use underscore and i think it comes from C posix standarts/notations.
C language doesn't support private and protected keywords so people generally use one or two underscore as pre extension for make the function private or protected.
Php firstly created as a functional language after a long time ZEND added object oriented features. So many people used to write it like a functional language. And so if you see a function like _save_cart you can understand that: an old school php coder make this function protected or private with posix way.