Functions that are aliases should they be used or not?

2

I remember that some time ago, when I was starting programming with PHP, I saw in some tutorials a recommendation, warning that it was to avoid using some functions that are nicknames for others.

I do not know if I'm wrong, but in the PHP Manual itself, when you entered the page of a function that was an alias (such as session_commit and sizeof ), it had a warning something like this: / p>

  

The y function is a nickname for the x function, so its use should be avoided as it can be removed in future versions.

I may be wrong, but I get the impression that there was a time when I would comment that new php versions would remove all aliases from functions, to make things more organized .

But what I've noticed is that even after PHP 7 is released, function aliases are still there, and there is no recommendation when to use them.

Examples:

I wonder if there is any danger in using these synonymous / nickname functions, because of the risk of being removed in the future.

Using function aliases could be bad also from the point of view of some coding standard in PHP, such as the PSR?

For example, would you have any problem using sizeof instead of count ?

    
asked by anonymous 19.01.2017 / 12:49

1 answer

2

The ideal is to always use the root 'language' or the orginal name of the function. The team that takes care of the development does almost everything to keep the compatibility newer versions with the previous ones so something disorganized to delay to get elminated. Remember that these aliases have been defined in some context.

Functions that are used quite hard would have some alias removed such as join() / implode() as this would cause a huge incompatibility in codes.

Now an example of several deleted aliases is in the MySQLi library, see mysqli_bind_param () / mysqli_stmt_bind_param ()

    
19.01.2017 / 13:02