# Consistent function names

- Thread: https://externals.io/message/84102
- Original archive: https://news-web.php.net/php.internals/84102
- Started by Yasuo Ohgaki on 2015-03-01T11:29:49+00:00
- Messages: 125
- Page 1 of 5: messages 1 to 25 (25 per page, add `?page=N` to the URL)
- Next page: https://externals.io/message/84102.md?page=2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #84102 — Yasuo Ohgaki — 2015-03-01T11:29:49+00:00

URL: https://externals.io/message/84102#84102

Hi all,

First of all, I have no intention removing old function names.

PHP function names are subject of critics for a long time.
http://www.phpsadness.com/sad/4
http://www.phpsadness.com/sad/15
http://www.phpsadness.com/sad/27

How about rename all of these functions according to CODING_STANDARD for
PHP7
and have aliases for old names? Some names need complete rename, but most of
them are matter of adding "_".

Function names like `phpversion()`, `htmlentities()`, image*() shouldn't be
kept. IMHO.
(I repeat. I have no intention removing old names)

str*() would be most difficult. How about rename all of them to str_*()?
and keep
libc compatible alias names forever?

Thoughts?

It's last chance for PHP7.
Sorry that I bring up this topic again, but I couldn't resist.
If there isn't many objections, I'll write RFC and do all the work needed.

Regards,

--
Yasuo Ohgaki
yohgaki@ohgaki.net

---

## #84103 — Benoit Schildknecht — 2015-03-01T12:11:49+00:00

URL: https://externals.io/message/84102#84103 · In reply to: #84102

Hi,

I like this idea. But I'm afraid of BC. There will be some scripts who  
won't work after that, because they already use functions with these names.

But since we already have some BC for PHP 7, I think it's about the right  
time to do this.

But we have to keep the old names for at least 2 or 3 major versions.  
Let's say :
- PHP 7 : We introduce the new functions names
- PHP 8 : We deprecate the old functions names
- PHP 9 : We delete the old functions names.

Regards.

Le Sun, 01 Mar 2015 12:29:49 +0100, Yasuo Ohgaki <yohgaki@ohgaki.net> a  
écrit:

> Hi all,
>
> First of all, I have no intention removing old function names.
>
> PHP function names are subject of critics for a long time.
> http://www.phpsadness.com/sad/4
> http://www.phpsadness.com/sad/15
> http://www.phpsadness.com/sad/27
>
> How about rename all of these functions according to CODING_STANDARD for
> PHP7
> and have aliases for old names? Some names need complete rename, but  
> most of
> them are matter of adding "_".
>
> Function names like `phpversion()`, `htmlentities()`, image*() shouldn't be
> kept. IMHO.
> (I repeat. I have no intention removing old names)
>
> str*() would be most difficult. How about rename all of them to str_*()?
> and keep
> libc compatible alias names forever?
>
> Thoughts?
>
> It's last chance for PHP7.
> Sorry that I bring up this topic again, but I couldn't resist.
> If there isn't many objections, I'll write RFC and do all the work  
> needed.
>
> Regards,
>
> --
> Yasuo Ohgaki
> yohgaki@ohgaki.net


-- 
Utilisant le logiciel de courrier d'Opera : http://www.opera.com/mail/

---

## #84104 — Rowan Collins — 2015-03-01T12:53:56+00:00

URL: https://externals.io/message/84102#84104 · In reply to: #84102

>How about rename all of these functions according to CODING_STANDARD
>for
>PHP7
>and have aliases for old names? 

If this list had an FAQ (which I think it should), this would be on it.

The answer is no, it's just not worth it. Having a function called str_pos which is an alias of strpos, but only on some versions, is more confusing, not less.

Some people, such as the author of phpsadness.com, enjoy ranting about things, and would probably find a way to be as critical of the new aliases as the current names.

Regards,
-- 
Rowan Collins
[IMSoP]

---

## #84106 — Markus Fischer — 2015-03-01T14:23:37+00:00

URL: https://externals.io/message/84102#84106 · In reply to: #84104

> 
> 
> > […]
> 
> If this list had an FAQ (which I think it should), this would be on it.
> 
> The answer is no, it's just not worth it. Having a function called str_pos which is an alias of strpos, but only on some versions, is more confusing, not less.

My sentiment too. Factor in that someone already using the proposed
himself, things can only go south from here.

If PHP wants to clean up, then do it right: use a namespace for it.

- Markus

---

## #84108 — S.A.N — 2015-03-01T15:18:09+00:00

URL: https://externals.io/message/84102#84108 · In reply to: #84106

Maybe better implement for method calls on primitive types in PHP 7?
https://github.com/nikic/scalar_objects

---

## #84110 — Rowan Collins — 2015-03-01T17:22:05+00:00

URL: https://externals.io/message/84102#84110 · In reply to: #84108

>Maybe better implement for method calls on primitive types in PHP 7?
>https://github.com/nikic/scalar_objects

We'd have a whole bunch of tough decisions to make - does HTML escaping really belong as a method of the string type? What are printf and scanf methods of? Etc

Without the ability for a user to patch the existing type (a major departure from current classes), you basically still have a bunch of function aliases. What motivation would there be to change dozens of instances of strpos($a, $b) to $a->indexOf($b)?

In this respect, some version of UString makes more sense, because (if well-defined) it actually gives users some advantage over the current functions.

Regards,
-- 
Rowan Collins
[IMSoP]

---

## #84112 — Alain Williams — 2015-03-01T18:53:07+00:00

URL: https://externals.io/message/84102#84112 · In reply to: #84110

> 
> > […]
> 
> We'd have a whole bunch of tough decisions to make - does HTML escaping really belong as a method of the string type? What are printf and scanf methods of? Etc
> 
> Without the ability for a user to patch the existing type (a major departure from current classes), you basically still have a bunch of function aliases. What motivation would there be to change dozens of instances of strpos($a, $b) to $a->indexOf($b)?

This could be implemented but the existing functions (eg `strpos()`) could be left.

This would set the model for new functions on basic types, etc, to be
implemented as methods.

If replacing strlen($str) by $str.length is really wanted, then allow a very long
cross over time so that people do not need 2 versions of their code: 1 for
method calls & the other basic functions. Thus if this were implemented in, say,
PHP 7 warnings would be generated by default in PHP 9 and removal in PHP 11.

It would, however, almost create a new language ... or what feels like a new language.

> In this respect, some version of UString makes more sense, because (if well-defined) it actually gives users some advantage over the current functions.

-- 
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer.
+44 (0) 787 668 0256  http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php
#include <std_disclaimer.h

---

## #84115 — Yasuo Ohgaki — 2015-03-01T20:19:24+00:00

URL: https://externals.io/message/84102#84115 · In reply to: #84106

Hi Markus and Fischer,



> 
> > […]
> str_pos which is an alias of strpos, but only on some versions, is more
> confusing, not less.
>
> My sentiment too. Factor in that someone already using the proposed
> himself, things can only go south from here.
>
> If PHP wants to clean up, then do it right: use a namespace for it.


I agree use of namespace is better solution. It's rather severe BC, though.
How about rename functions except "string" and "array" related functions?

BTW, I cannot change document system, but I'm going to update all doc
contents if this passes.

Regards,

--
Yasuo Ohgaki
yohgaki@ohgaki.net

---

## #84137 — Terry Cullen — 2015-03-02T00:17:54+00:00

URL: https://externals.io/message/84102#84137 · In reply to: #84108

> Maybe better implement for method calls on primitive types in PHP 7?
> https://github.com/nikic/scalar_objects
>
>
​I've searched through the internals archive looking for debate on using
scalar objects without much luck.  I'd love to see some discussion around
this as it seems like it would go a long way to resolving some common pain
points in PHP without BC like:

   - type hints
   - inconsistant function naming
   - needle/haystack
   - unicode

And, the method chaining of common string/array manipulations makes for
cleaner, easier to read code.

I've used the scalar objects extension and found it a pleasure to use over
the standard function but I can't use it in my larger client projects due
to it not being in the core and it's experimental status.

​Also see: https://github.com/rossriley/php-scalar-objects​

---

## #84138 — S.A.N — 2015-03-02T00:55:08+00:00

URL: https://externals.io/message/84102#84138 · In reply to: #84137

2015-03-02 2:17 GMT+02:00 Terry Cullen <terry@terah.com.au>:
> 
>
> > […]
> I've searched through the internals archive looking for debate on using
> scalar objects without much luck.  I'd love to see some discussion around
> this as it seems like it would go a long way to resolving some common pain
> points in PHP without BC like:
>
>    - type hints
>    - inconsistant function naming
>    - needle/haystack
>    - unicode
>
> And, the method chaining of common string/array manipulations makes for
> cleaner, easier to read code.
>

+1

---

## #84139 — Yasuo Ohgaki — 2015-03-02T01:30:29+00:00

URL: https://externals.io/message/84102#84139 · In reply to: #84138

Hi all,



> 2015-03-02 2:17 GMT+02:00 Terry Cullen <terry@terah.com.au>:
> > […]
> pain
> > […]
>
> +1


I'm strong supporter for scalar objects also.

I still would like to clean up old function names, like `phpversion()`/etc.
I did this for pgsql module large object functions about 10 years ago.
It worked well enough. IMHO.

http://php.net/manual/en/function.pg-lo-open.php
pg_lo_open() was named pg_loopen(). The old name aliases, pg_loopen()/etc,
are
available now, too.

Regards,

--
Yasuo Ohgaki
yohgaki@ohgaki.net

---

## #84140 — Yasuo Ohgaki — 2015-03-02T02:19:33+00:00

URL: https://externals.io/message/84102#84140 · In reply to: #84110

Hi Rowan,

On Mon, Mar 2, 2015 at 2:22 AM, Rowan Collins <rowan.collins@gmail.com>
wrote:

> 
> > […]
>
> We'd have a whole bunch of tough decisions to make - does HTML escaping
> really belong as a method of the string type? What are printf and scanf
> methods of? Etc
>
> Without the ability for a user to patch the existing type (a major
> departure from current classes), you basically still have a bunch of
> function aliases. What motivation would there be to change dozens of
> instances of strpos($a, $b) to $a->indexOf($b)?
>
> In this respect, some version of UString makes more sense, because (if
> well-defined) it actually gives users some advantage over the current
> functions.


I agree. We may improve "string" as well, but comprehensive UString
implementation would be better.
Regardless of new APIs for strings, old string APIs will remain and other
APIs remain. We are better
to clean up anyway, IMHO.

Regards,

--
Yasuo Ohgaki
yohgaki@ohgaki.net

---

## #84149 — Markus Fischer — 2015-03-02T07:47:38+00:00

URL: https://externals.io/message/84102#84149 · In reply to: #84115

Hello!


> > […]
> 
> 
> I agree use of namespace is better solution. It's rather severe BC, though.
> How about rename functions except "string" and "array" related functions?
> 
> BTW, I cannot change document system, but I'm going to update all doc
> contents if this passes.

I'm not sure we're on the same page. I'm talking about moving in
"no-BC-break" way, if at all. That is, no existing function be touched.

As to whether namespaces-aliases are really necessary I leave for others.

I think a sensible thing to do at this stage would be, rather than
changing existing stuff, laying the ground work how to do it in the
future. What I mean is: an RFC for consistent introducing new "names" in
the PHP language.

So that /future/ functionality does not always get slapped into the
global namespace but that we finally start using our reserved PHP\
namespace and put stuff in there instead of the global pollution.

Yeah, I think that direction is a sensible start and gather peoples
mindset about this instead of going backwards, renaming stuff without
clear plan, etc.

thank you,
- Markus

---

## #84188 — Yasuo Ohgaki — 2015-03-02T21:39:32+00:00

URL: https://externals.io/message/84102#84188 · In reply to: #84149

Hi Markus,



> 
> > […]
> though.
> > […]
> ?
> > […]
>
> I'm not sure we're on the same page. I'm talking about moving in
> "no-BC-break" way, if at all. That is, no existing function be touched.
>

I would love to have namespace that could be imported like

namespace \php\7\function\* as \; // Import all functions to \
namespace \php\7\function\* as \;

and have INI like

default_namespaces "\php\7\function\* \php\5\function\*"

This way, we'll have no-BC since user can select functions to import.
(Namespace layout should be improved. Above example will have issues
most certainly)

Your idea is similar to this, I guess.


>
> As to whether namespaces-aliases are really necessary I leave for others.
>
> I think a sensible thing to do at this stage would be, rather than
> changing existing stuff, laying the ground work how to do it in the
> future. What I mean is: an RFC for consistent introducing new "names" in
> the PHP language.
>
> So that /future/ functionality does not always get slapped into the
> global namespace but that we finally start using our reserved PHP\
> namespace and put stuff in there instead of the global pollution.
>
> Yeah, I think that direction is a sensible start and gather peoples
> mindset about this instead of going backwards, renaming stuff without
> clear plan, etc.


We may postpone some renames.
I wrote almost complete list. Please take a look at

https://wiki.php.net/rfc/consistent_function_names#list_of_functions_to_be_renamed

There are many functions that can have aliases safely.
I'll post [RFC][DISCUSSION] now. Please comment on new thread!

Thank you.

--
Yasuo Ohgaki
yohgaki@ohgaki.net

---

## #84187 — Pierre Joye — 2015-03-02T21:40:11+00:00

URL: https://externals.io/message/84102#84187 · In reply to: #84102

hi,


> Hi all,
>
> First of all, I have no intention removing old function names.
>
> PHP function names are subject of critics for a long time.
> http://www.phpsadness.com/sad/4
> http://www.phpsadness.com/sad/15
> http://www.phpsadness.com/sad/27
>
> How about rename all of these functions according to CODING_STANDARD for
> PHP7
> and have aliases for old names? Some names need complete rename, but most of
> them are matter of adding "_".
>
> Function names like `phpversion()`, `htmlentities()`, image*() shouldn't be
> kept. IMHO.
> (I repeat. I have no intention removing old names)
>
> str*() would be most difficult. How about rename all of them to str_*()?
> and keep
> libc compatible alias names forever?
>
> Thoughts?

I see no gain to do that. It also won't solve the arguments order mess.

The last time we discuss this topic the idea was to go for the new
pseudo object for most scalar, something Nikita worked on with a
prototype, allowing something like $mystring->replace(...); But adding
name aliases only to get names_defined_correctly sounds like a bad
move to me.

Cheers,
Pierre

---

## #84190 — Yasuo Ohgaki — 2015-03-02T21:58:23+00:00

URL: https://externals.io/message/84102#84190 · In reply to: #84187

Hi Pierre,



> 
> > […]
> most of
> > […]
>
> I see no gain to do that. It also won't solve the arguments order mess.
>
> The last time we discuss this topic the idea was to go for the new
> pseudo object for most scalar, something Nikita worked on with a
> prototype, allowing something like $mystring->replace(...); But adding
> name aliases only to get names_defined_correctly sounds like a bad
> move to me.


Sadly, this proposal only renames functions and has aliases for old names.
We may try to fix argument order mess when we have "default namespace"!
I just don't have time to do all the job at once...

I posted [RFC][DISCUSSION] as new thread. Please look at the list of rename
candidates. I think you'll agree to rename most of them.

Regards,

--
Yasuo Ohgaki
yohgaki@ohgaki.net

---

## #84192 — Lester Caine — 2015-03-02T22:00:11+00:00

URL: https://externals.io/message/84102#84192 · In reply to: #84188

> I wrote almost complete list. Please take a look at
> https://wiki.php.net/rfc/consistent_function_names#list_of_functions_to_be_renamed

While the idea of this is well meant, this is another major problem for
developers working with substantial legacy code yet needing to update
third party libraries. The statement "You can use old names for good."
is all very well, but if one library has been 'modernised and another
not, one has to work with both sets of names in parallel ... or maintain
legacy copies of the same libraries.

Updating the PHP documentation is all very well, but how about
tutorials, books, third party tools and so on. I would still like some
help to update PHPEclipse to the recent PHP5 changes without having to
code a complete new set of reserved words and highlighting ... ore
reason to simply ditch PHP7 ...

-- 
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

---

## #84193 — Pierre Joye — 2015-03-02T22:01:21+00:00

URL: https://externals.io/message/84102#84193 · In reply to: #84190

> Hi Pierre,
>
> 
> > […]
>
>
> Sadly, this proposal only renames functions and has aliases for old names.
> We may try to fix argument order mess when we have "default namespace"!
> I just don't have time to do all the job at once...
>
> I posted [RFC][DISCUSSION] as new thread. Please look at the list of rename
> candidates. I think you'll agree to rename most of them.

Sorry, I do not see how a new thread helps. Namespace either. These
will only be duplicated APIs for little to no gain. Existing codes
won't move as they won't be compatible with 5.x.

We should really consider Nikita's experiment instead,as it acutally
brings some big plus. Simple aliases for the sake of having _ in the
names bring nothing but confusion in my humble opinion.

Cheers,
-- 
Pierre

@pierrejoye | http://www.libgd.org

---

## #84194 — Yasuo Ohgaki — 2015-03-02T22:09:04+00:00

URL: https://externals.io/message/84102#84194 · In reply to: #84192

Hi Lester,



> 
> > […]
> https://wiki.php.net/rfc/consistent_function_names#list_of_functions_to_be_renamed
>
> While the idea of this is well meant, this is another major problem for
> developers working with substantial legacy code yet needing to update
> third party libraries. The statement "You can use old names for good."
> is all very well, but if one library has been 'modernised and another
> not, one has to work with both sets of names in parallel ... or maintain
> legacy copies of the same libraries.
>

I think old function names should exist forever, so there wouldn't be
issue you mentioned.


>
> Updating the PHP documentation is all very well, but how about
> tutorials, books, third party tools and so on. I would still like some
> help to update PHPEclipse to the recent PHP5 changes without having to
> code a complete new set of reserved words and highlighting ... ore
> reason to simply ditch PHP7 ...


Old names works. No one forces users to use new names.
I'll update PHP documents. It's a lot of work, but I'll.
3rd party documents may be update if they would like to.

The issue here is PHP will keep inconsistent names forever or not.
IMHO.

Regards,

--
Yasuo Ohgaki
yohgaki@ohgaki.net

---

## #84195 — Larry Garfield — 2015-03-02T22:22:21+00:00

URL: https://externals.io/message/84102#84195 · In reply to: #84193

> Sorry, I do not see how a new thread helps. Namespace either. These
> will only be duplicated APIs for little to no gain. Existing codes
> won't move as they won't be compatible with 5.x.
>
> We should really consider Nikita's experiment instead,as it acutally
> brings some big plus. Simple aliases for the sake of having _ in the
> names bring nothing but confusion in my humble opinion.
>
> Cheers,

This topic has come up many times, and that is always the answer.  We 
should look at something meaningful (methods on scalars, which 
eliminates the parameter order issue as well) rather than just duplicate 
function names.

This is at least the third time we've had this thread and come to that 
same statement.  I agree with it.

So what's the blocker on discussing Nikita's work for core?

--Larry Garfield

---

## #84196 — Yasuo Ohgaki — 2015-03-02T22:36:54+00:00

URL: https://externals.io/message/84102#84196 · In reply to: #84195

Hi Larry,

On Tue, Mar 3, 2015 at 7:22 AM, Larry Garfield <larry@garfieldtech.com>
wrote:

>
>  Sorry, I do not see how a new thread helps. Namespace either. These
> > […]
>
> This topic has come up many times, and that is always the answer.  We
> should look at something meaningful (methods on scalars, which eliminates
> the parameter order issue as well) rather than just duplicate function
> names.
>
> This is at least the third time we've had this thread and come to that
> same statement.  I agree with it.
>
> So what's the blocker on discussing Nikita's work for core?


I like scalar objects, but it does not resolve that PHP has non standard
function names.
It does not change old names, therefore it's impossible to resolve issue.
This is the reason why I'm proposing while I like scalar object, use of
namespace, etc.

Many of proposed candidates have nothing to do with scalar object also.

https://wiki.php.net/rfc/consistent_function_names#list_of_functions_to_be_renamed
Functions other than Standard module

http://php.net/manual/en/book.sockets.php
socket_get_peer_name ← socket_getpeername
socket_get_sock_name ← socket_getsockname
socket_recv_from ← socket_recvfrom
socket_recv_msg ← socket_recvmsg
socket_send_msg ← socket_sendmsg
socket_send_to ← socket_sendto
socket_error_str ← socket_strerror (Adjust to accord with other function
names. e.g. bz_error_str())
http://php.net/manual/en/book.bc.php
bc_add ← bcadd
bc_comp ← bccomp
bc_div ← bcdiv
bc_mod ← bcmod
bc_mul ← bcmul
bc_pow ← bcpow
bc_pow_mod ← bcpowmod
bc_scale ← bcscale
bc_sqrt ← bcsqrt
bc_sub ← bcsub
http://php.net/manual/en/book.gettext.php
gettext_bind_text_domain_codeset ← bind_textdomain_codeset
gettext_bind_text_domain ← bindtextdomain
gettext_dc ← dcgettext
gettext_dcn ← dcngettext
gettext_d ← dgettext
gettext_dn ← dngettext
gettext_n ← ngettext
gettext_text_domain ← textdomain
http://php.net/manual/en/book.bzip2.php
bz_close → bzclose
bz_compress → bzcompress
bz_decompress → bzdecompress
bz_errno → bzerrno
bz_error → bzerror
bz_error_str → bzerrstr
bz_flush → bzflush
bz_open → bzopen
bz_read → bzread
bz_write → bzwrite
http://php.net/manual/en/book.zlib.php
gz_close → gzclose
gz_compress → gzcompress
gz_decode → gzdecode
gz_deflate → gzdeflate
gz_encode → gzencode
gz_eof → gzeof
gz_file → gzfile
gz_getc → gzgetc
gz_gets → gzgets
gz_getss → gzgetss
gz_inflate → gzinflate
gz_open → gzopen
gz_passthru → gzpassthru
gz_puts → gzputs
gz_read → gzread
gz_rewind → gzrewind
gz_seek → gzseek
gz_tell → gztell
gz_uncompress → gzuncompress
gz_write → gzwrite
gz_read_file → readgzfile
http://php.net/manual/en/book.image.php
gd_image_size → getimagesize
gd_image_size_from_string → getimagesizefromstring
gd_type_to_extension → image_type_to_extension
gd_type_to_mime_type → image_type_to_mime_type
gd_2wbmp → image2wbmp
gd_affine → imageaffine
gd_affine_matrix_concat → imageaffinematrixconcat
gd_affine_matrix_get → imageaffinematrixget
gd_alpha_blending → imagealphablending
gd_antialias → imageantialias
gd_arc → imagearc
gd_char → imagechar
gd_charup → imagecharup
gd_color_allocate → imagecolorallocate
gd_color_allocate_alpha → imagecolorallocatealpha
gd_color_at → imagecolorat
gd_color_closest → imagecolorclosest
gd_color_closest_alpha → imagecolorclosestalpha
gd_color_closest_hwb → imagecolorclosesthwb
gd_color_deallocate → imagecolordeallocate
gd_color_exact → imagecolorexact
gd_color_exact_alpha → imagecolorexactalpha
gd_color_match → imagecolormatch
gd_color_resolve → imagecolorresolve
gd_color_resolve_alpha → imagecolorresolvealpha
gd_color_set → imagecolorset
gd_colors_for_index → imagecolorsforindex
gd_colors_total → imagecolorstotal
gd_color_transparent → imagecolortransparent
gd_convolution → imageconvolution
gd_copy → imagecopy
gd_copy_merge → imagecopymerge
gd_copy_merge_gray → imagecopymergegray
gd_copy_resampled → imagecopyresampled
gd_copy_resized → imagecopyresized
gd_create → imagecreate
gd_create_from_gd2 → imagecreatefromgd2
gd_create_from_gd2_part → imagecreatefromgd2part
gd_create_from_gd → imagecreatefromgd
gd_create_from_gif → imagecreatefromgif
gd_create_from_jpeg → imagecreatefromjpeg
gd_create_from_png → imagecreatefrompng
gd_create_from_string → imagecreatefromstring
gd_create_from_wbmp → imagecreatefromwbmp
gd_create_from_webp → imagecreatefromwebp
gd_create_from_xbm → imagecreatefromxbm
gd_create_from_xpm → imagecreatefromxpm
gd_create_true_color → imagecreatetruecolor
gd_crop → imagecrop
gd_crop_auto → imagecropauto
gd_dashed_line → imagedashedline
gd_destroy → imagedestroy
gd_ellipse → imageellipse
gd_fill → imagefill
gd_filled_arc → imagefilledarc
gd_filled_ellipse → imagefilledellipse
gd_filled_polygon → imagefilledpolygon
gd_filled_rectangle → imagefilledrectangle
gd_fill_to_border → imagefilltoborder
gd_filter → imagefilter
gd_flip → imageflip
gd_font_height → imagefontheight
gd_font_width → imagefontwidth
gd_ft_bbox → imageftbbox
gd_ft_text → imagefttext
gd_gamma_correct → imagegammacorrect
gd_raw2 → imagegd2
gd_raw → imagegd
gd_gif → imagegif
gd_grab_screen → imagegrabscreen
gd_grab_window → imagegrabwindow
gd_interlace → imageinterlace
gd_is_true_color → imageistruecolor
gd_jpeg → imagejpeg
gd_layer_effect → imagelayereffect
gd_line → imageline
gd_load_font → imageloadfont
gd_palette_copy → imagepalettecopy
gd_palette_to_true_color → imagepalettetotruecolor
gd_png → imagepng
gd_polygon → imagepolygon
gd_ps_bbox → imagepsbbox
gd_ps_encode_font → imagepsencodefont
gd_ps_extend_font → imagepsextendfont
gd_ps_free_font → imagepsfreefont
gd_ps_load_font → imagepsloadfont
gd_ps_slant_font → imagepsslantfont
gd_ps_text → imagepstext
gd_rectangle → imagerectangle
gd_rotate → imagerotate
gd_save_alpha → imagesavealpha
gd_scale → imagescale
gd_set_brush → imagesetbrush
gd_set_interpolation → imagesetinterpolation
gd_set_pixel → imagesetpixel
gd_set_style → imagesetstyle
gd_set_thickness → imagesetthickness
gd_set_tile → imagesettile
gd_string → imagestring
gd_string_up → imagestringup
gd_width → imagesx
gd_height → imagesy
gd_true_color_to_palette → imagetruecolortopalette
gd_ttf_bbox → imagettfbbox
gd_ttf_text → imagettftext
gd_types → imagetypes
gd_wbmp → imagewbmp
gd_webp → imagewebp
gd_xbm → imagexbm
gd_iptc_embed → iptcembed
gd_iptc_parse → iptcparse
gd_jpeg2wbmp → jpeg2wbmp
gd_png2wbmp → png2wbmp
http://php.net/manual/en/book.exif.php
exif_image_type → exif_imagetype
exif_tag_name → exif_tagname
http://php.net/manual/en/book.mbstring.php
mb_decode_mime_header → mb_decode_mimeheader
mb_decode_numeric_entity → mb_decode_numericentity
mb_encode_mime_header → mb_encode_mimeheader
mb_encode_numeric_entity → mb_encode_numericentity
Date/Time related:
http://php.net/manual/en/book.datetime.php
date_format → date (Return formatted date string of timestamp)
date_get → getdate (Return array date)
date_check → checkdate
time_part → idate (Retrieve part of date information as int according to
format)
time → time (The same as it is now. Return int timestamp)
time_make → mktime (Return timestamp from number of int parameters)
time_format → strftime (Return lobal time string according to format/locale)
time_utc → gmdate (Return array GMT/UTC timestamp)
time_utc_make → gmmktime (Return GMT/UTC timestamp from array)
time_utc_format → gmstrftime (Return GMT/UTC time string according to
format/locale)
time_get → gettimeofday (Return array time of day)
time_local → localtime (Return `localtime()` result array. More info than
time_get/gettimeofday)
time_micro → microtime (Return microtime resolution time)
time_parse → strptime (Parse time string generated by time_format/strftime.
Return timestamp)
time_from_string → strtotime (Parse string time and return timestamp.
Return timestamp)
http://php.net/manual/en/book.apache.php
sapi_request_headers → getallheaders (Categorized as apache function, but
available for CLI and FCGI also)
apache_virtual → virtual
apache_get_env → apache_getenv
apache_set_env → apache_setenv
"String" functions

http://php.net/ref.strings
HTML related:
html_entities → htmlentities
html_escape → htmlspecialchars (Rename it with real meaning)
html_escape_decode → htmlspecialchars_decode
html_nl2br → nl2br
html_strip_tags → strip_tags
Locate related:
locale_conv → localeconv
locale_set → setlocale
“string” function but no “str_” prefix
str_cslashes → addcslashes
str_cslashes_strip → stripcslashes
str_slashes → addslashes
str_slashes_strip → stripslashes
str_count_chars → count_chars
str_explode → explode
str_implode → implode
str_money_format → money_format
str_number_format → number_format
str_levenshtein → levenshtein
str_metaphone → metaphone
str_parse → parse_str
str_quote_meta → quotemeta
str_similar_text → similar_text
str_soundex → soundex
str_sscanf → sscanf
str_rtrim → rtrim
str_trim → trim
str_ltrim → ltrim
str_lc_first → lcfirst
str_uc_first → ucfirst
str_uc_words → ucwords
str_word_wrap → wordwrap
Comparison:
str_cmp → strcmp
str_ncmp → strncmp
str_case_cmp → strcasecmp
str_ncase_cmp → strncasecmp
str_nat_cmp → strnatcmp
str_nat_case_cmp → strnatcasecmp
Conversion:
str_to_lower → strtolower
str_to_upper → strtoupper
Misc:
str_get_csv → str_getcsv
Named after libc:
ord → ord (Keep as it is now)
chr → chr (Keep as it is now. str_chr() is `strstr()` alias.)
str_chr → strchr
str_cmp → strcmp
str_coll → strcoll
str_cspn → strcspn
str_ipos → stripos
str_istr → stristr
str_len → strlen
str_pbrk → strpbrk
str_pos → strpos
str_rchr → strrchr
str_rev → strrev
str_ripos → strripos
str_rpos → strrpos
str_spn → strspn
str_str → strstr
str_tok → strtok
str_tr → strtr
http://php.net/manual/en/book.mbstring.php
mb_str_cut → mb_strcut
mb_strim_width → mb_strimwidth
mb_str_ipos → mb_stripos
mb_str_istr → mb_stristr
mb_str_len → mb_strlen
mb_str_pos → mb_strpos
mb_str_rchr → mb_strrchr
mb_str_richr → mb_strrichr
mb_str_ripos → mb_strripos
mb_str_rpos → mb_strrpos
mb_str_str → mb_strstr
mb_str_to_lower → mb_strtolower
mb_str_to_upper → mb_strtoupper
mb_str_width → mb_strwidth
http://php.net/manual/en/book.iconv.php
iconv_str_len → iconv_strlen
iconv_str_pos → iconv_strpos
iconv_str_rpos → iconv_strrpos
http://php.net/manual/en/book.intl.php
grapheme_str_ipos → grapheme_stripos
grapheme_str_istr → grapheme_stristr
grapheme_str_len → grapheme_strlen
grapheme_str_pos → grapheme_strpos
grapheme_str_ripos → grapheme_strripos
grapheme_str_rpos → grapheme_strrpos
grapheme_str_str → grapheme_strstr
"Array" functions

http://php.net/manual/en/ref.array.php
array_sort → sort (Sort values)
array_sort_reverse → rsort (Reverse sort values)
array_sort_user → usort (User sort values)
array_sort_assoc → asort (Keep key and sort)
array_sort_assoc_reverse → arsort (Keep key and reverse sort)
array_sort_assoc_user → uasort (Keep key and user sort)
array_sort_key → ksort (Sort keys)
array_sort_key_reverse → krsort (Reverse sort keys)
array_sort_key_user → uksort (User key sort)
array_sort_natual → natsort (Natural sort)
array_sort_natual_case → natcasesort (Natural sort without case)
array_in → in_array
array_range → range (Create array of range)
array_shuffle → shuffle (Randomize values)
Other than "string" and "array" standard module functions

http://php.net/manual/en/book.misc.php
time_sleep ← sleep
time_nano_sleep ← time_nanosleep
time_micro_sleep ← usleep
time_unique_id ← uniqid (uniqid() is `microtime()` based)
sys_get_load_avg ← sys_getloadavg
php_strip_white_space ← php_strip_whitespace
http://php.net/manual/en/book.url.php
url_decode ← urldecode
url_encode ← urlencode
url_raw_decode ← rawurldecode
url_raw_encode ← rawurlencode
url_parse ← parse_url
url_build_query ← http_build_query (Make it URL function)
http://php.net/manual/en/ref.info.php
php_credits ← phpcredits
php_info ← phpinfo
php_version ← phpversion
get_last_mod ← getlastmod (Return main script timestamp.)
get_my_gid ← getmygid (“my_” prefix used because they return info about
current script.)
get_my_inode ← getmyinode
get_my_pid ← getmypid
get_my_uid ← getmyuid
get_rusage ← getrusage
get_opt ← getopt
get_env ← getenv
put_env ← putenv
http://php.net/manual/en/book.var.php
bool_val ← boolval
double_val ← doubleval
float_val ← floatval
int_val ← intval
str_val ← strval
get_type ← gettype
set_type ← settype
is_set ← isset (There are number of is_*(). e.g.is_int()/is_string()/etc)
http://php.net/manual/en/ref.exec.php
exec ← exec (exec() remains as it is)
exec_passthru ← passthru (Named after `exec()`)
exec_shell ← shell_exec
exec_system ← system
exec_escape_arg ← escapeshellarg
exec_escape_cmd ← escapeshellcmd
http://php.net/manual/en/ref.filesystem.php
disk_free_space ← diskfreespace
link ← link (The same as now)
link_info ← linkinfo
link_stat ← lstat
link_chown ← lchown
link_chgrp ← lchgrp
link_read ← readlink
link_symbolic ← symlink
path_base_name ← basename
path_info ← pathinfo
read_file ← readfile (This could be file_read() or file_passthru(), but
file_read() conflict with `fread()`, file_passthru() conflict with
 `fpassthru()`. Any good name?)
pipe_close ← pclose
pipe_open ← popen
realpath related : Could be as it is now?
realpath ← realpath
realpath_cache_get ← realpath_cache_get
realpath_cache_size ← realpath_cache_size
file_atime ← fileatime
file_ctime ← filectime
file_group ← filegroup
file_inode ← fileinode
file_mtime ← filemtime
file_owner ← fileowner
file_perms ← fileperms
file_size ← filesize
file_type ← filetype
file_name_match ← fnmatch
file_temp_name ← tempnam
file_copy ← copy
file_stat() ← `stat()`
file_stat_clear_cache ← clearstatcache
f*() : Prefixed by file_? - It's supposed to be named as “file module”. If
“f” prefix is kept, there should be “ftmp(tmpfile)”,“frewind(rewind)”
because these operates with file handle.
file_open ← fopen
file_close ← fclose
file_eof ← feof
file_flush ← fflush
file_getc ← fgetc
file_get_csv ← fgetcsv
file_gets ← fgets
file_getss ← fgetss
file_passthru ← fpassthru
file_put_csv ← fputcsv
file_puts ← fputs
file_read ← fread
file_scanf ← fscanf
file_seek ← fseek
file_stat ← fstat
file_tell ← ftell
file_truncate ← ftruncate
file_write ← fwrite
file_rewind ← rewind (This one is exception that does not have “f” prefix,
but returns file handle)
file_temp ← tmpfile (This one is exception that does not have “f” prefix,
but operates with file handle)
file_delete ← unlink (There is dummy “delete()” function entry for
 `unlink()`. Unlink is a directory operation in fact, but made it as
file_delete(). There will be dir_delete())
Directory related : Prefixed by dir_? It's supposed to be named as “dir
module”
dir_name ← dirname
dir_glob ← glob
dir_rename ← rename (Rename is actually a directory operation. e.g File
deletion/rename is controlled by current dir permission)
dir_delete ← rmdir
dir_create ← mkdir
dir_chown ← chown
dir_chmod ← chmod
dir_chgrp ← chgrp
Methods

StdClass::__setState() ← StdClass::__set_state() →
SessionIdInterface::createSid() ← SessionIdInterface::create_sid()


--
Yasuo Ohgaki
yohgaki@ohgaki.net

---

## #84197 — Rowan Collins — 2015-03-02T22:40:26+00:00

URL: https://externals.io/message/84102#84197 · In reply to: #84194

> I think old function names should exist forever, so there wouldn't be
> issue you mentioned.

...

> The issue here is PHP will keep inconsistent names forever or not.
> IMHO.

Have you noticed the slight contradiction here? You want to get rid of 
the inconsistent names, but you propose to keep the old, inconsistent, 
names around forever. And then you want to add more names, so that 
people can inconsistently use a different name for the same thing.

We all wish we could go back in time and tell Rasmus to choose better 
names (probably including Rasmus himself; no ill will intended!), but 
just adding some slightly different names for the same things will 
muddle people more, not less.

I'm sorry, but this isn't going to be any more popular a suggestion than 
the last ten times it was proposed.

Regards,

-- 
Rowan Collins
[IMSoP]

---

## #84198 — Lester Caine — 2015-03-02T22:40:42+00:00

URL: https://externals.io/message/84102#84198 · In reply to: #84194

> 
> Old names works. No one forces users to use new names.
> I'll update PHP documents. It's a lot of work, but I'll.
> 3rd party documents may be update if they would like to.

Some developers will drop PHP5 support for third party libraries in much
the same way as they will enable 'strict' by default. *WE* have no
control over that other than either maintaining our own version of the
same libraries or simply not bothering to risk the problems of
upgrading. "No one forces users to use new names" is simply burying head
in sand ... there will be those who insist that names must be changed if
the 'modern way' is made available.

> The issue here is PHP will keep inconsistent names forever or not.
> IMHO.

Some of the extensions that you want to rename could be provided as
completely self contained replacements if that is what people need, and
at the same time restructure the parameters to be 'more consistent'
leaving the legacy suite in place. The suggestion has been made many
times that an alternate string or array extension as an option would be
a lot more practical and then a legacy build can be maintained.

gd is probably a good case for that approach, as some of us still use
imagick to provide the same facilities anyway, or gmagick or magickwand
and changing the cross reference charts from gd will not be helpful.

-- 
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

---

## #84199 — Rowan Collins — 2015-03-02T22:50:36+00:00

URL: https://externals.io/message/84102#84199 · In reply to: #84196

> I like scalar objects, but it does not resolve that PHP has non standard
> function names.
> It does not change old names, therefore it's impossible to resolve issue.
> This is the reason why I'm proposing while I like scalar object, use of
> namespace, etc.

Again, you're contradicting yourself here - you can't say that your 
mission is to change the old names, rather than offer an alternative, 
but then also say that the old names will stay around forever. If both 
names exist, that's exactly what you've created - an alternative.

If we're going to have an alternative, let's come up with a creative 
alternative that actually has an advantage to using it, not a choice 
between equally cryptic names like "strripos" vs "str_ripos".

Regards,

-- 
Rowan Collins
[IMSoP]

---

## #84200 — Yasuo Ohgaki — 2015-03-02T22:53:00+00:00

URL: https://externals.io/message/84102#84200 · In reply to: #84197

Hi Rowan,

On Tue, Mar 3, 2015 at 7:40 AM, Rowan Collins <rowan.collins@gmail.com>
wrote:

> The issue here is PHP will keep inconsistent names forever or not.
> > […]
>
> Have you noticed the slight contradiction here? You want to get rid of the
> inconsistent names, but you propose to keep the old, inconsistent, names
> around forever. And then you want to add more names, so that people can
> inconsistently use a different name for the same thing.


I should have written "PHP will keep _only_ inconsistent names forever or
not".
My proposal is to have consistent names that accord CORDING_STARNDARDS,
not eliminating inconsistent names.

Regards,

--
Yasuo Ohgaki
yohgaki@ohgaki.net

---

Next page: https://externals.io/message/84102.md?page=2
