Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

array() VS Array()

 
   Database Forums (Home) -> PHP RSS
Next:  Help with Design of Database  
Author Message
howachen

External


Since: Feb 18, 2006
Posts: 1



(Msg. 1) Posted: Sat May 13, 2006 9:14 am
Post subject: array() VS Array()
Archived from groups: comp>lang>php (more info?)

which one is recommend?

seems they perform the same thing...


regards,
howa

 >> Stay informed about: array() VS Array() 
Back to top
Login to vote
Janwillem Borleffs1

External


Since: Sep 17, 2003
Posts: 170



(Msg. 2) Posted: Sat May 13, 2006 11:43 pm
Post subject: Re: array() VS Array() [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

wrote:
> which one is recommend?
>
> seems they perform the same thing...
>

The lowercase notation, because the case-insensitive handling of function-
and language construct names might be removed from future PHP versions and
'array' is the preferred notation.


JW

 >> Stay informed about: array() VS Array() 
Back to top
Login to vote
Kimmo Laine

External


Since: Dec 28, 2005
Posts: 17



(Msg. 3) Posted: Mon May 15, 2006 11:10 am
Post subject: Re: array() VS Array() [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Tony Marston" wrote in message

>
> "Janwillem Borleffs" wrote in message
>
>> wrote:
>>> which one is recommend?
>>>
>>> seems they perform the same thing...
>>>
>>
>> The lowercase notation, because the case-insensitive handling of
>> function- and language construct names might be removed from future PHP
>> versions and 'array' is the preferred notation.
>
> The removal of case-insensitive functions names would be a totally WRONG
> move IMHO as it would serve no useful purpose. The argument "to be
> consistent with other languages" just does not hold water as it would be
> doing nothing but perpetuating a bad idea. If having case-insensitive
> names does not cause a problem then it does not need a solution.


Surely we've all heard your opinion and in fact it was discussed a lot some
time ago. Now let it rest. You can write aRRaY() for all I care, but if
someone asks if there is a preference, I see no harm done if one is
recommended. But noooo... You just _had_ to tell once again how much you
hate the case-sensitivity, didn't you? As if it were the end of the world.

--
"ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" -lpk
spam RemoveThis @outolempi.net | Gedoon-S @ IRCnet | rot13(xvzzb@bhgbyrzcv.arg)
 >> Stay informed about: array() VS Array() 
Back to top
Login to vote
Kimmo Laine

External


Since: Dec 28, 2005
Posts: 17



(Msg. 4) Posted: Mon May 15, 2006 2:40 pm
Post subject: Re: array() VS Array() [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Tony Marston" wrote in message

>
> "Andy Jeffries" wrote in message
>
>> On Sun, 14 May 2006 16:38:26 +0100, Tony Marston wrote:
>>> The removal of case-insensitive functions names would be a totally WRONG
>>> move IMHO as it would serve no useful purpose. The argument "to be
>>> consistent with other languages"
>>
>> I'd say a better argument would be so it's consistent with itself.
>> Variable names and member variables are case-sensitive so it's counter
>> intuitive to a beginner to have the language partially case-sensitive.
>>
>> Just MHO....
>
> But if a language allows the same name to mean different things if
> specified in a different case this could lead to code which is confusing
> and therefore difficult to maintain. It *should* be the primary objective
> of every language to avoid such features instead of deliberately
> implementing them. This is why the GOT verb is frowned upon and excluded
> from many languages, and why the ALTER verb in COBOL is considered an
> absolute no-no.
>
> In the English language a word has only one meaning regardless of case
> (such as 'dog', 'Dog' and 'DOG') so why should computer languages be any
> different?
>


WeLL IF that IS iNdEED the CAse That CapS Don'T MATTER at all in ENgliSH
then why DO You SupPose We HaVE them IN thE FIRST PlacE? If IT dOEsN'T MAKE
AnY DIFfeRence TheN WHY is Writing likE This annoying? I say that they DO
have more than one meaning. Why do we write spoken languagues like English
starting each sentence or name with a capital letter and the rest in small
letters? It's just a set of rules, and when spoken the caps doen't mean
anything.

Why do we have these rules then? To distinct certain differences, to improve
readability of the writing. For instance 'Jack' and 'jack' mean different
things. With a capital J Jack is someone's name, but with a lower case j it
could mean a microphone plug or a jack hammer. Equally in PHP it's common
practise that defined constants are written with CAPITALS and mostly
everything else in lowercase. Likewise it's traditional to write SQL
KEYWORDS in capital and fieldnames in lowercase in an SQL query. There _is_
a difference between small and capitals, you just fail to see it because
you're clinging to the fact that PHP is a spoken language (which it is not).

--
"ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" -lpk
spam.DeleteThis@outolempi.net | Gedoon-S @ IRCnet | rot13(xvzzb@bhgbyrzcv.arg)
 >> Stay informed about: array() VS Array() 
Back to top
Login to vote
Ryan Lange

External


Since: May 15, 2006
Posts: 1



(Msg. 5) Posted: Mon May 15, 2006 2:42 pm
Post subject: Re: array() VS Array() [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Tony Marston wrote:
> In the English language a word has only one meaning regardless of case (such
> as 'dog', 'Dog' and 'DOG') so why should computer languages be any
> different?

That's pretty wrong, actually. The word "dog" is a noun that refers
to canines. The word "Dog" would be a proper noun; the name of a person
or place. The word "DOG" would be an acronym.

Personally, when I see "htmlEntities()" my brain tells me that's
different from "htmlentities()", and it wouldn't be wrong, strictly
speaking.

In the end it's really just personal opinion. Yours is just one of
many, and I happen to disagree with it.


Ryan
 >> Stay informed about: array() VS Array() 
Back to top
Login to vote
Jerry Stuckle

External


Since: Aug 11, 2004
Posts: 1367



(Msg. 6) Posted: Mon May 15, 2006 2:48 pm
Post subject: Re: array() VS Array() [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Tony Marston wrote:
>
> No. My point is that I have worked for over 20 years using computer
> languages which were totally insensitive to case (assembler, COBOL, quiz,
> quick, qtp, SPL, Rapid, Transact, Insight, Uniface, SQL) and I cannot see
> any problem which is solved by making any language sensitive to case. Just
> the opposite, in fact, I can only see the introducion of new problems.
>

Not this argument again. Give it up, Tony. You aren't going to change the world.

For the record - I have almost twice as many years of programming as you do,
starting with Fortran in the mid-60's. My first case sensitive language was C
in the mid 1980's - probably about the time you started programming. Over the
years I've written code in over a dozen different languages, including PL/I,
Assembler (both mainframe and PC), REXX, PASCAL, BASIC, C++ and Java.

I've seen definite advantages to case sensitivity, and have grown to like it.
For instance, I can declare a class Customer. I can then have variable names
like customer, customer1, customer2, etc. - or even an array customer[].

I find it not at all confusing. Class names start with caps. Variable names do
not. Simple and easy. And a programmer can quickly relate the variable to the
class using it.

And, as others have pointed out, use all caps anything defined as a CONSTANT.
That way you know it's a constant.

And that's the way PHP is, whether you like it or not. And if you hate it so
much, go back to COBOL or another case-insensitive language.

But don't keep bringing this topic up. It only shows how stubborn you are.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex.RemoveThis@attglobal.net
==================
 >> Stay informed about: array() VS Array() 
Back to top
Login to vote
user

External


Since: May 15, 2006
Posts: 1



(Msg. 7) Posted: Mon May 15, 2006 5:14 pm
Post subject: Re: array() VS Array() [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I must say I agree with parent. A good example would be the subtle
difference between "God" and "god". These do *not* mean the same thing.


"Kimmo Laine" wrote in message

> "Tony Marston" wrote in message
>
>>
>> "Andy Jeffries" wrote in message
>>
>>> On Sun, 14 May 2006 16:38:26 +0100, Tony Marston wrote:
>>>> The removal of case-insensitive functions names would be a totally
>>>> WRONG
>>>> move IMHO as it would serve no useful purpose. The argument "to be
>>>> consistent with other languages"
>>>
>>> I'd say a better argument would be so it's consistent with itself.
>>> Variable names and member variables are case-sensitive so it's counter
>>> intuitive to a beginner to have the language partially case-sensitive.
>>>
>>> Just MHO....
>>
>> But if a language allows the same name to mean different things if
>> specified in a different case this could lead to code which is confusing
>> and therefore difficult to maintain. It *should* be the primary objective
>> of every language to avoid such features instead of deliberately
>> implementing them. This is why the GOT verb is frowned upon and excluded
>> from many languages, and why the ALTER verb in COBOL is considered an
>> absolute no-no.
>>
>> In the English language a word has only one meaning regardless of case
>> (such as 'dog', 'Dog' and 'DOG') so why should computer languages be any
>> different?
>>
>
>
> WeLL IF that IS iNdEED the CAse That CapS Don'T MATTER at all in ENgliSH
> then why DO You SupPose We HaVE them IN thE FIRST PlacE? If IT dOEsN'T
> MAKE AnY DIFfeRence TheN WHY is Writing likE This annoying? I say that
> they DO have more than one meaning. Why do we write spoken languagues like
> English starting each sentence or name with a capital letter and the rest
> in small letters? It's just a set of rules, and when spoken the caps
> doen't mean anything.
>
> Why do we have these rules then? To distinct certain differences, to
> improve readability of the writing. For instance 'Jack' and 'jack' mean
> different things. With a capital J Jack is someone's name, but with a
> lower case j it could mean a microphone plug or a jack hammer. Equally in
> PHP it's common practise that defined constants are written with CAPITALS
> and mostly everything else in lowercase. Likewise it's traditional to
> write SQL KEYWORDS in capital and fieldnames in lowercase in an SQL query.
> There _is_ a difference between small and capitals, you just fail to see
> it because you're clinging to the fact that PHP is a spoken language
> (which it is not).
>
> --
> "ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" -lpk
> spam.TakeThisOut@outolempi.net | Gedoon-S @ IRCnet | rot13(xvzzb@bhgbyrzcv.arg)
>
 >> Stay informed about: array() VS Array() 
Back to top
Login to vote
Gary L. Burnore

External


Since: Jun 13, 2004
Posts: 73



(Msg. 8) Posted: Mon May 15, 2006 6:35 pm
Post subject: Re: array() VS Array() [Login to view extended thread Info.]
Imported from groups: per prev. post (more info?)

Back to top
Login to vote
Jerry Stuckle

External


Since: Aug 11, 2004
Posts: 1367



(Msg. 9) Posted: Mon May 15, 2006 8:58 pm
Post subject: Re: array() VS Array() [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Tony Marston wrote:
> All the while people like you keep harping on about how "politically
> correct" it is to introduce even more unnecessary case-sensitivity into
> computer languages I will keep responding with an alternative view. Case
> sensitivity does not solve any problems, therefore it is an unwanted
> solution.
>

I never said anything about "politically correct". I pointed out some real
advantages to having case sensitivity - advantages used by millions of
programmers world-wide.

And here's tony, still a stubborn mule and clinging to th dark ages, refusing to
see advantages because he doesn't want to.

You really are an ass.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex RemoveThis @attglobal.net
==================
 >> Stay informed about: array() VS Array() 
Back to top
Login to vote
Richard Levasseur

External


Since: Feb 10, 2006
Posts: 7



(Msg. 10) Posted: Tue May 16, 2006 1:20 am
Post subject: Re: array() VS Array() [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

RE: Variable case
Traditionally,
FOO is read as a global literal constant, you cannot change this and is
available everywhere and is intended to be used both inside and outside
the project.
$FOO, $foo, $Foo can be read in wildly different ways. By and large i
see:

$FOO as a global variable for a specific application. Usually because
you can't pre-initialize it in the class or without doing something
before hand, and typically you don't change these, they're a
honor-system read only.
$foo is a local variable, something that only exists within the current
scope and goes away later.
$Foo i rarely see, though usually it means its important for some
reason, such as some sort of glue between a function and something
outside the function, or a reference to something within another
something-something. The point is it doesn't quite adhere to the
locality of $foo but isn't as off limits and viewable as $FOO; I like
to think of it as akin to 'protected' in OOP terminology. Occasionally
I see important public methods starting with a capital and using camel
notation, such as functions that should be called during shutdown or
startup prior to any other calls.

(Aside, this is one reason i like how perl differentiates uses with $,
#, and @, it gives me a better understanding of what context it should
be used and read in)

So, yes, traditionally, case does have an impact on the implied meaning
of what a variable does, where it is used, and so forth. You can have
case insensitivity when there are language constructs that strictly
limit how a variable is used. 'local refererence constant $foo;
global copy variable $FOO; bridging constant local $Foo' etc etc

Re: Function case
1) It would be nice to have consistancy throughout the language.
Previously, classes were stored in all lowercase, and later this was
changed to match the declared case. (Thank god!)
2) You know what to expect when you are looking for a function or
declared identifier. I declare it as 'myFunc', and its stored as
'myfunc,' but i naturally expect it to match the way I wrote it. Now I
have to write case insensitivity into determining if its the function i
want, and to verify that whatever information i'm storing is, indeed
correct? Rubbish i say.
If i call it myfunc, MYFUNC, or MyFuCn, i expect to be able to refer to
it only as how i defined it. Making it 'fuzzy' sounds sloppy and
doesn't, in my opinion, promote good coding habits. I'd much rather
have an error handler catch a programming mistake than the computer
assume it knew what i meant.
3) If i call it MYFUNC, i'm capitalizing it for a reason. Calling it
as myfunc() is not what i am expecting to look for in code if i go
reading it over and downplays the importants that this function must
server. hack_together_sql() has a different authority to it than
Hack_Together_SQL(). The former tends to imply that its a hack and
shouldn't be relied on, the latter that it is some complicated
necessity to be used with caution, and the importance of both of those
meanings should always be present in the writing of them.

Re: maintainance nightmare
You've not seen some of the 'professional' PHP code out there you can
buy? Half of them don't even spell variable names right, let alone
adhere to any sort of standard or continuity. I'd much rather pick up
any code and understand the intent of it instead of being able to skip
pressing the shift key.

Of course, thats just how I see things.
 >> Stay informed about: array() VS Array() 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
accessing array data inside of an array - I want to extract the name of the photo uploaded. print_r of $_FILES yields: Files: Array ( [picture] => Array ( [name] => DSC_1802-saoirse-riona.jpg [type] => image/jpeg [tmp_name] => /tmp/phpJTspHZ [error] => 0 [size] => 76096 ) ) ...

Array - Hi Can you help me sort my array on salary $Person[$personid][salary] e.g. $Person[1][20000] $Person[2][5000] $Person[3][15000] $Person[4][10000] to $Person[2][5000] $Person[4][10000] $Person[3][15000] $Person[1][20000] Thanx

SUM of array - I want to get the sum of the array key values. ex: $key1=>10, $key2=>15, $key3=>5 I want variable $sum = 30. any solution?

Last element of array ? - I need the first, last and middle elements of a (single dimension) array during a loop which may then add 0..n elements to it so I don't know how many elements are in it the next run. Right now I use: [....] $len = count($arr); $var0 = $arr[0];...

assosiativ array - I have this array, $navbar_left = array( 'Hjem'=>'index.php', 'Borte'=>'borte.php', 'Uavgjort'=>'uavgjort.php' ); I want to loop through it, but don't know how. I've tried foreach($navbar_left as $navbar){ foreach($navbar as $key=>$value){ ...
   Database Forums (Home) -> PHP All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]