为什么手册中函数举例都用foo()作为函数名呢?

comehope 北京酷云互动科技有限公司 技术经理  2004-05-08 11:29:32
foo是什么单词的缩写?什么意思?
...全文
189 16 点赞 打赏 收藏 举报
写回复
16 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
ccterran 2004-05-09
哈哈~~~~^_^
  • 打赏
  • 举报
回复
mistjin 2004-05-09
oh, my god!!!
  • 打赏
  • 举报
回复
www0aspsun0com 2004-05-09
我觉得就是
function object oriented
大家觉得呢?
  • 打赏
  • 举报
回复
sports98 2004-05-08
那早先咱们学这个的时候还HelloWorld呢
  • 打赏
  • 举报
回复
comehope 2004-05-08
本来叫什么也无所谓的,可是就像一个地名,一个街道名,总是有些渊源的,总不能是随机命名成 foo 的吧?还是想知道。
  • 打赏
  • 举报
回复
sports98 2004-05-08
既然是举例你还在意那么多做啥?

无所谓了,你要是喜欢随便用个非保留字的来做就是了
  • 打赏
  • 举报
回复
ccterran 2004-05-08
呵呵。http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?foo

<jargon> /foo/ A sample name for absolutely anything, especially programs and files (especially scratch files). First on the standard list of metasyntactic variables used in syntax examples. See also bar, baz, qux, quux, corge, grault, garply, waldo, fred, plugh, xyzzy, thud.

The etymology of "foo" is obscure. When used in connection with "bar" it is generally traced to the WWII-era Army slang acronym FUBAR, later bowdlerised to foobar.

However, the use of the word "foo" itself has more complicated antecedents, including a long history in comic strips and cartoons.

"FOO" often appeared in the "Smokey Stover" comic strip by Bill Holman. This surrealist strip about a fireman appeared in various American comics including "Everybody's" between about 1930 and 1952. FOO was often included on licence plates of cars and in nonsense sayings in the background of some frames such as "He who foos last foos best" or "Many smoke but foo men chew".

Allegedly, "FOO" and "BAR" also occurred in Walt Kelly's "Pogo" strips. In the 1938 cartoon "The Daffy Doc", a very early version of Daffy Duck holds up a sign saying "SILENCE IS FOO!". Oddly, this seems to refer to some approving or positive affirmative use of foo. It has been suggested that this might be related to the Chinese word "fu" (sometimes transliterated "foo"), which can mean "happiness" when spoken with the proper tone (the lion-dog guardians flanking the steps of many Chinese restaurants are properly called "fu dogs").

Earlier versions of this entry suggested the possibility that hacker usage actually sprang from "FOO, Lampoons and Parody", the title of a comic book first issued in September 1958, a joint project of Charles and Robert Crumb. Though Robert Crumb (then in his mid-teens) later became one of the most important and influential artists in underground comics, this venture was hardly a success; indeed, the brothers later burned most of the existing copies in disgust. The title FOO was featured in large letters on the front cover. However, very few copies of this comic actually circulated, and students of Crumb's "oeuvre" have established that this title was a reference to the earlier Smokey Stover comics.

An old-time member reports that in the 1959 "Dictionary of the TMRC Language", compiled at TMRC there was an entry that went something like this:

FOO: The first syllable of the sacred chant phrase "FOO MANE PADME HUM." Our first obligation is to keep the foo counters turning.

For more about the legendary foo counters, see TMRC. Almost the entire staff of what became the MIT AI LAB was involved with TMRC, and probably picked the word up there.

Another correspondant cites the nautical construction "foo-foo" (or "poo-poo"), used to refer to something effeminate or some technical thing whose name has been forgotten, e.g. "foo-foo box", "foo-foo valve". This was common on ships by the early nineteenth century.

Very probably, hackish "foo" had no single origin and derives through all these channels from Yiddish "feh" and/or English "fooey".
  • 打赏
  • 举报
回复
cloudchen 2004-05-08
记得在哪里看到过的,但不是PHP的文章

foo代表你想代表的任何东西。。。好象是这样的
  • 打赏
  • 举报
回复
sahafu89 2004-05-08
搂主是不是分太多了?呵呵,接分
  • 打赏
  • 举报
回复
caaclxf 2004-05-08
原因就是~他喜欢
  • 打赏
  • 举报
回复
demong 2004-05-08
呵呵!
  • 打赏
  • 举报
回复
mistjin 2004-05-08
一般子类都是Bar,
class Bar extends foo {
......
}
  • 打赏
  • 举报
回复
xuzuning 2004-05-08
fool —— 愚人
  • 打赏
  • 举报
回复
52juanjuan 2004-05-08
没有必要吧,这一般是一个不成名的规范而已
  • 打赏
  • 举报
回复
xylegend 2004-05-08
hello word是很经典的例子...几乎所有语言的第一个Demo程序都用它
不过PHP手册为什么用foo确实不知道....
  • 打赏
  • 举报
回复
comehope 2004-05-08
Hello World的渊源:
将Hello World程序作为第一个学写的程序,现在已经成为一种传统。该程序最早出现在由Brian Kernighan和Dennis Ritchie写的计算机程序设计教程《C编程语言》。
  • 打赏
  • 举报
回复
相关推荐
发帖
基础编程
加入

2.1w+

社区成员

从PHP安装配置,PHP入门,PHP基础到PHP应用
申请成为版主
帖子事件
创建了帖子
2004-05-08 11:29
社区公告
暂无公告