A
A
Anton Medvedev2011-02-02 15:26:30
PHP
Anton Medvedev, 2011-02-02 15:26:30

What to choose: $someVar or $some_var?

What to choose: $someVar or $some_var?

Answer the question

In order to leave comments, you need to log in

21 answer(s)
G
gro, 2011-02-02
@gro

Throw a coin.
This topic will give no more information, but there will be a lot of flooding.

M
MT, 2011-02-02
@MTonly

$someVar;
$object->someMethod();
$params['some_param'];

S
SlaX, 2011-02-02
@SlaX

We have adopted $someVar, but I rarely see names like $some_var, except in scripts.

I
Iskander Giniyatullin, 2011-02-02
@rednaxi

code-cruising.net/underscore-vs-camelcase-naming-convention

R
rakot, 2011-02-02
@rakot

$someVar is a class parameter.
$some_var is an internal variable inside the method.

C
cypok, 2011-02-02
@cypok

Depends on the language, framework used. Everywhere has its principles.

E
Eugene, 2011-02-02
@Agent_J

Depends on what you're working with. For example, in ZendFramework it is customary to use camelCaps [ proof ].
But by and large, it doesn’t matter, the main thing is that you yourself always adhere to the rule adopted by yourself.

L
lashtal, 2011-02-02
@lashtal

for camelCase variables, for under_score() functions

I
Ivan Klimchuk, 2011-02-02
@Alroniks

for variables I use camelCaps… here they write that for functions it is better to use the underscore method, but I don’t like it… I also use camelCase for functions.

D
deactivatedtheelephant, 2011-02-03
@deactivatedtheelephant

Practice shows that the third option, $p $a and of course $c, is the most common.
Mother by the leg!

A
AFoST, 2011-02-02
@AFoST

More familiar camelCaps.
And slightly, but the length of the line is reduced.

V
VeXell, 2011-02-02
@VeXell

Start using the Zend coding standard (http://zend-framework.ru/pamyatka-po-standartam-kodirovaniya/) and many questions will disappear.

P
Pavlo Ponomarenko, 2011-02-02
@TheShock

In Javascript, it’s generally bad manners to write under_score, only camelCase. At the same time, in ruby, as I understand it, it is necessary to write only with underscores. So really - look at the environment.
I prefer camelcase

V
Vladimir Chernyshev, 2011-02-02
@VolCh

I use camelCaps for variables, properties, methods and functions. In addition to a shorter length, they allow you to visually separate your functions from the standard ones (not always, but often).

I
IRuslan, 2011-02-03
@IRuslan

In Drupal, for example ( coding standard ), it is accepted as follows:
$some_var
class SomeClass {
}
$object->someMethod()
$object->someProperty

V
Vyacheslav Plisko, 2011-02-03
@AmdY

in php, it is customary to use the PEAR style, now the Zend Framework, these are the two most powerful sets of libraries that can be easily integrated into your project. It will be very frustrating when the project ends up with a mixture of styles. it's better to just use it without hesitation, although there are a lot of pros and cons.
If you want to deal with the issue in more detail, then I advise you to read McConnell: Perfect code
This will prove once again that there is no ideal approach.

E
Eugene, 2011-02-02
@Agent_J

I use camelCaps (aka camelCase)

A
Anatoly, 2011-02-02
@taliban

The answer is really obvious, and depends on two things:
1 - What libraries do you work with? Perhaps you should use their style?
2 - Which option do you personally like more? The main thing is to choose one and always stick to it.

C
charon, 2011-02-03
@charon

I use camelCase, I just saw such examples more often and I intuitively like it more.

K
Kirill Firsov, 2011-02-03
@Isis

I use camelcase for everything.

A
Aquahawk, 2011-02-03
@Aquahawk

UpperCamelCase for classes and lowerCamelCase for variables and functions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question