473,513 Members | 2,505 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why $i ?

I see people using $i alot, is there something special about it? why not use
$z or $a
Jul 17 '05 #1
17 1498
On Fri, 18 Mar 2005 17:38:43 -0000, mike wrote:
I see people using $i alot, is there something special about it? why not use
$z or $a


"i" has always been the first variable name of choice for _i_teration or
_i_ndexing.
--
Firefox Web Browser - Rediscover the web - http://getffox.com/
Thunderbird E-mail and Newsgroups - http://gettbird.com/
Jul 17 '05 #2
mike <mi*@localhost.com> wrote:
I see people using $i alot, is there something special about it? why not use
$z or $a


$i(int(eger))

Jul 17 '05 #3
On Fri, 18 Mar 2005 17:38:43 -0000
"mike" <mi*@localhost.com> wrote:

:I see people using $i alot, is there something special about it? why not use
:$z or $a
:
:

I think it originally stood for "integer." Why foo.bar?

--
Looks like more of Texas to Me
Jul 17 '05 #4
*** mike wrote/escribió (Fri, 18 Mar 2005 17:38:43 -0000):
I see people using $i alot, is there something special about it? why not use
$z or $a


In mathematics it's typical to use i for index variables. When you need
more, you follow the alphabet: i, j, k...

Constants are represented by: a, b, c...

Variables are: x, y, z...
--
-- Álvaro G. Vicario - Burgos, Spain
-- Don't e-mail me your questions, post them to the group
--
Jul 17 '05 #5
Warren Oates wrote:
On Fri, 18 Mar 2005 17:38:43 -0000
"mike" <mi*@localhost.com> wrote:

:I see people using $i alot, is there something special about it? why
:not use $z or $a

I think it originally stood for "integer." Why foo.bar?


Not really an explanation of foobar but somewhat interesting:
http://en.wikipedia.org/wiki/Foo
http://catb.org/~esr/jargon/html/F/foo.html

--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/
Jul 17 '05 #6
mike wrote:
I see people using $i alot, is there something special about it? why not use
$z or $a


It's goes back to the basis of programming: Calculus.

In the "Sigma" (Summation) notation, the standard "integer variable" is
normally denoted by "i" or some variable with a subscript "i"; however,
most younger people now use the variable "n".

So it's just as appropriate to use $n as opposed to $i. It's just
preference: 'I'nteger or i'N'teger

--TekWiz
Jul 17 '05 #7
Warren Oates wrote:
On Fri, 18 Mar 2005 17:38:43 -0000
"mike" <mi*@localhost.com> wrote:

:I see people using $i alot, is there something special about it? why not use
:$z or $a
:
:

I think it originally stood for "integer." Why foo.bar?


The New Hacker's Dictionary: 3rd Ed. Compiled by Eric S. Raymond says this:

The term "foo" has it's American English roots in WWII Army slang:
"FUBAR" ("Fucked Up Beyond All Repair") which hackers later bowdlerized
into "foobar"

However, it can be traced even further back to the Yiddish word "feh"
and/or English "fooey."

This is the definition that it gives.

"foo /foo/ 1. interj. Term of disgust. 2. Used very generally as a
sample name for absolutely anything, esp. programs and files (esp.
scratch files). 3. First on the standard list of metasyntactic
variables used in syntax examples."

--TekWiz
Jul 17 '05 #8
NC
mike wrote:

I see people using $i alot, is there something special about it?


Yes, there is. Tradition. If a mathematician wanted to write
"the sum of first five numbers in sequence X", he would write
something like:

5
Sigma (Xi)
i=1

Obviously, "Sigma" would be a capital-case Greek letter and
the "i" in "Xi" would be a subscript...

Quite a few of early programmers were in fact mathematicians,
so they brought over the tradition of "i" (and "j" for two-
dimensional problems, and "k" for three-dimensional ones)
being a cycle variable.

Cheers,
NC

Jul 17 '05 #9
mike wrote:
I see people using $i alot, is there something special about it? why not use
$z or $a

Historical. In fortran, by default, variables starting with i, j, k and
l ( and maybe more, I forget now ) were integers.
Jul 17 '05 #10
>> I see people using $i alot, is there something special about it? why not use
$z or $a

Historical. In fortran, by default, variables starting with i, j, k and
l ( and maybe more, I forget now ) were integers.


FORTRAN had integer variables by default beginning with I, J, K,
L, M, or N. Variables beginning with other letters were real by
default. You could declare the type explicitly.

I believe the mathematical usage of indexes such as i, j, and k far
predates FORTRAN or any other computer language.

Gordon L. Burditt
Jul 17 '05 #11
mike wrote:
I see people using $i alot, is there something special about it? why not use
$z or $a

Because $i stands for "Incredible fast code"
Jul 17 '05 #12

"mike" <mi*@localhost.com> wrote in message
news:d1**********@news7.svr.pol.co.uk...
I see people using $i alot, is there something special about it? why not use $z or $a


Because most programmers are right-handed?
Jul 17 '05 #13
Warren Oates wrote:

On Fri, 18 Mar 2005 17:38:43 -0000
"mike" <mi*@localhost.com> wrote:

:I see people using $i alot, is there something special about it? why not use
:$z or $a
:
:

I think it originally stood for "integer." Why foo.bar?

--
Looks like more of Texas to Me

Close.

It originated back in the 60's with FORTRAN, where the default integers
variable names started with I through N (I think). All others were by
default real (floating point) values.

So, FORTRAN programmers would use I, J, K, etc. as loop counters. And
as they moved into other languages, they just kept using them.

The first reference to foo and bar I know of was in the original IBM PC
DOS 1.0 documentation, where they were used in various examples.
Someone had a good sense of humor (at IBM? naw... :-) ). It was taken
from the old military acronym FUBAR, meaning Fouled (or a less family
oriented word...) Up Beyond All Recognition. This, BTW, was the
superlative. Others were SNAFU (Situation Normal, All Fouled Up) and
TARFU (Things Are Really Fouled Up).
--

To reply, delete the 'x' from my email
Jerry Stuckle,
JDS Computer Training Corp.
js*******@attglobal.net
Member of Independent Computer Consultants Association - www.icca.org
Jul 17 '05 #14
Jerry Stuckle wrote:
It originated back in the 60's with FORTRAN, where the default integers
variable names started with I through N (I think). All others were by
default real (floating point) values.


Hence the old saying

GOD IS REAL UNLESS DECLARED INTEGER.

Only valid in all caps. :)

Kristian
Jul 17 '05 #15
Thus FORTRAN was coined as an acronym for FORmula TRANslation.

--

"Gordon Burditt" <go****@hammy.burditt.org> wrote in message
news:42**********************@news.airnews.net...
I see people using $i alot, is there something special about it? why not use $z or $a

Historical. In fortran, by default, variables starting with i, j, k and
l ( and maybe more, I forget now ) were integers.


FORTRAN had integer variables by default beginning with I, J, K,
L, M, or N. Variables beginning with other letters were real by
default. You could declare the type explicitly.

I believe the mathematical usage of indexes such as i, j, and k far
predates FORTRAN or any other computer language.

Gordon L. Burditt

Jul 17 '05 #16
> It's goes back to the basis of programming: Calculus.

In the "Sigma" (Summation) notation, the standard "integer variable" is normally denoted by "i" or some variable with a subscript "i"; however, most younger people now use the variable "n".

So it's just as appropriate to use $n as opposed to $i. It's just
preference: 'I'nteger or i'N'teger


Actually, regarding the context in which one usually finds $i used, a
for loop....

I prefer $n to hold the bound value. Such as

for ($i=0, $n=count($arr); $i<$n; $i++) ....

This performs better than the second clause being "$i < count($arr)" as
the count() function only needs to be invoked once, rather than once
for every time through the loop. All in the spirit of "there's more
than one way...." (and just to head off any follow ups such as "just
use foreach....", sometimes you want to use a for loop, such as when
you might need to retain the value of $i at the point at which you
break out of the loop for some reason or other)

Jul 17 '05 #17


Kristian Köhntopp wrote:
Jerry Stuckle wrote:
It originated back in the 60's with FORTRAN, where the default integers
variable names started with I through N (I think). All others were by
default real (floating point) values.

Hence the old saying

GOD IS REAL UNLESS DECLARED INTEGER.

Only valid in all caps. :)

Kristian


It's been a long time since I heard that one! Thanks for the memories! :-)
Jul 17 '05 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
11180
by: William C. White | last post by:
Does anyone know of a way to use PHP /w Authorize.net AIM without using cURL? Our website is hosted on a shared drive and the webhost company doesn't installed additional software (such as cURL)...
2
5775
by: Albert Ahtenberg | last post by:
Hello, I don't know if it is only me but I was sure that header("Location:url") redirects the browser instantly to URL, or at least stops the execution of the code. But appearantely it continues...
3
22958
by: James | last post by:
Hi, I have a form with 2 fields. 'A' 'B' The user completes one of the fields and the form is submitted. On the results page I want to run a query, but this will change subject to which...
0
8436
by: Ollivier Robert | last post by:
Hello, I'm trying to link PHP with Oracle 9.2.0/OCI8 with gcc 3.2.3 on a Solaris9 system. The link succeeds but everytime I try to run php, I get a SEGV from inside the libcnltsh.so library. ...
1
8540
by: Richard Galli | last post by:
I want viewers to compare state laws on a single subject. Imagine a three-column table with a drop-down box on the top. A viewer selects a state from the list, and that state's text fills the...
4
18217
by: Albert Ahtenberg | last post by:
Hello, I have two questions. 1. When the user presses the back button and returns to a form he filled the form is reseted. How do I leave there the values he inserted? 2. When the...
1
6777
by: inderjit S Gabrie | last post by:
Hi all Here is the scenerio ...is it possibly to do this... i am getting valid course dates output on to a web which i have designed ....all is okay so far , look at the following web url ...
2
31347
by: Jack | last post by:
Hi All, What is the PHP equivilent of Oracle bind variables in a SQL statement, e.g. select x from y where z=:parameter Which in asp/jsp would be followed by some statements to bind a value...
3
23534
by: Sandwick | last post by:
I am trying to change the size of a drawing so they are all 3x3. the script below is what i was trying to use to cut it in half ... I get errors. I can display the normal picture but not the...
0
7161
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7384
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7101
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7525
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5089
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4746
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3222
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1596
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.