If you check fputs
in the PHP Manual , you'll get Note that it is an alias of fwrite
. Which means that it's actually the same function:
fputs
- Alias of fwrite()
Description
This function is an alias of: fwrite()
.
PHP has several similar cases, as explained in the section List of functions alias :
There are a few functions in PHP that can be called with more than one
first name. In some of the cases there is no preferred name of
Among the multiple names, is_int()
e is_integer()
are a good
example. However, there are functions that changed their name because of
a clean API or some other reason and the old names only
are preserved as aliases to maintain compatibility with versions
previous It is usually a bad idea to use this type of alias, as they can
become obsolete or change their name, and make it impossible to
portability of the script. This list is provided to help the
people who want to update their old code to a new one
syntax.
We must look for the reason why fputs
is an alias, to know if it is necessary to avoid its use.
Let's see:
When it says Base Syntax , it means that you can use either, because the alias reason is not due to saving compatibility with other libraries. Anyway, an alias will always be an alias. I would always use the original.