Why are php functions named so strangely? [closed] - php

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
It sometimes feels like a drunk person wrote all the functions for php...Some are combined words with no underscore, other times functions are randomly underscored...Like using 'strtolower' and 'str_replace'...why does the former not have underscores (like str_to_lower) and the later does? and for that matter why is 'replace' the full word but 'str' isn't 'string'? If we are shortening words why not "str_rep"? Or better yet, why shorten anything and instead just make everything clear, obvious and readable, like "string_replace" and maybe consistently apply this to all functions in php? Is there some reason for why these functions are so strangely named? Is it just sloppy laziness in the language or do these apparent inconsistencies have some meaning?

Have a look at the history of PHP: http://en.wikipedia.org/wiki/PHP#History
It was developed organically by different people, what resulted in this inconsistent naming.

Related

Naming functions in PHP [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I looked online and could not find any answer. I'm new to PHP and i've seen so many different ways of naming functions. Namely,
isset <- no underscore
is_integer <- underscore
fooBar <-subsequent words after the first have the first letter capitalized.
In what way do the functions differ in the way they work, such that they are named differently by convention? Or is it some other reason?
Earlier versions of PHP built-in functions had no naming conventions, that's why we have such a zoo. But, no, it does not matter how you name a function as long as you use naming conventions of your team.
If you're making shared public code/library you better stay close to, for example, http://www.php-fig.org/psr/psr-1/ PHP standards

Explanation of PHP opcode instructions [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I found the list of PHP opcodes and this helped me a bit to understand the internals of PHP. But I still have problems to exactly understand the scheme used to display all informations of the opcodes on this page. For example, look here under the section PHP opcodes. I already figured out that a "!" means variable, a "->" means line of code and a "~" seems to address a "memory for internal computed results", e.g. echo 2 + 3 has to compute 2 + 3 first, so the result will be stored temporarily.
I would really appreciate a detailed explanation of the characters used in the explanations of the opcodes and the meaning of the columns "fetch" and "ext". Also, there are no opcodes for the numbers 116-131 and 137. Does this have a meaning?

Do you advise against using text files instead of database? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
To make things short: I'm writing an anonymous forum software with PHP. I just feel like using a database is overkill and restrains my amateur skills. Do you advise against using text files instead of database?
Thanks.
A database has advantages like some sanitation (no breaking of delimiters, newlines etc.) and less danger of access conflicts when multiple instances try to read from the table - and different from a file-based approach, writing conflicts are constrained to the record in question only.
Recommendation: use database
To make things short: Yes. Strong advise against text files.

Require email registered to be from specific domain(s) [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
All,
I'm curious what the best approach to this would be. In case the tags weren't noticed, I'm using PHP and Laravel 4.
My application requires that users register with an email address that is from specific domain names. Currently there is only one domain, however, I can see it being a requirement to white list others.
I would assume it would be best to put the domains into an array. Would I run a regex from $rules array against that array? I'm somewhat green to regex. I don't use it often enough to commit anything advanced to memory so feel free to talk to me like a 2 year old.
You can create a custom validator for this. See http://laravel.com/docs/validation#custom-validation-rules for reference.

Why is PHP inconsistent? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Though, a best kick-start development language; but I don't know why PHP lacks of consistency in naming functions etc? I've been developing for years, but most often I miss-spell function names and forget their parameter structures. Why isn't there any standard conventions followed in PHP for naming? Some times, it's like substr and sometimes str_replace? I often forget if needle should be first argument or second? or haystack be first or second? Is team behind PHP working on developing a consistent conventions and names?

Categories