Why is PHP inconsistent? [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 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?

Related

In PHP 7, what's the use of stdClass with the availability of anonymous classes? [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
As of PHP 7 we have access to anonymous classes. This means we could ditch stdClass when we need generic object as a return value... But which one would be cleaner?
What other differences are between those two guys?
Is there any performance drawback on creating an anonymous class? i.e. as each one has a different "class name", is there any additional impact?
Do both work "the same way" from the developer point of view, or are they actually two different beasts in some cases?

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

Find perpendicular segments at ends of segment [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 7 years ago.
Improve this question
Hello,
I'm making an application in which I have the points (p0,p1), and need to find the points for perpendicular segments at the end of (p0,p1)... namely, (A,B) and (C,D), which are of length $len.
There is a similar question to this one in this post, but unfortunately I am not sure about how to interpret the answer...
I'm using php for this project, but the solution can be in any language as I can translate it later.
(A-E)/(l/2) = (p1-F)/L
and so on...

Why are php functions named so strangely? [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
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.

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.

Categories